finding a row in access database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sobnc
    New Member
    • Sep 2006
    • 1

    #1

    finding a row in access database

    Please sir
    I have an access database from which I would like to find automaticaly an existing a part of a row. For example if my database stores customers informations such as name, surname, address, phone and i want to find inside this dbase a customer that name is for example "Borris" I should have :
    - A form of screen where the user would enter the part of the row ej : "Borris"
    - A button find to launch the recherch
    That is my problem
    Yvan
  • MMcCarthy
    Recognized Expert MVP
    • Aug 2006
    • 14387

    #2
    Create a blank form and put a textbox on it. Lets call it txtLastName (if you need to search the first name as well, I would create a second version of this).

    Put a command button on the form called cmdSearch labeled appropriately and in the on click event of the button put the following:

    Code:
    Private Sub cmdSearch_Click()
    On Error GoTo Err_cmdSearch_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    	stDocName = "RecordForm"
    	stLinkCriteria = "[LastName]=" & "'*" & Me![txtLastName] & "*'"
       
    	DoCmd.OpenForm stDocName, , , stLinkCriteria
    Exit_cmdSearch_Click:
    Exit Sub
    Err_cmdSearch_Click:
    		MsgBox Err.Description, , "Error in Finding this record"
    		Resume Exit_cmdSearch_Click
    	Resume 0	'.FOR TROUBLESHOOTING
    End Sub

    Originally posted by sobnc
    Please sir
    I have an access database from which I would like to find automaticaly an existing a part of a row. For example if my database stores customers informations such as name, surname, address, phone and i want to find inside this dbase a customer that name is for example "Borris" I should have :
    - A form of screen where the user would enter the part of the row ej : "Borris"
    - A button find to launch the recherch
    That is my problem
    Yvan

    Comment

    Working...