crono.Serge
06-23-2006, 12:40 AM
I'm not sure where this belongs, but I'll put it here for now.
I'm working on a database, and I wanted to make a search function on a form. When the user enters a salesman's name, a manager's name or a year, and hits the search button, a query will be thrown, and display the results.
I know how to do this in coldfusion, but, how do I do this in access. Do I write a macro or sometype of script? If so...is this correct?
Private Sub btnSMSearch_Click()
On Error GoTo Err_cmdAtlantic_Click
Dim stDocName As String
Dim stSMQuery As String
stSMQuery = "qrytablebysalesman"
stDocName = stSMQuery
If Not IsNull(Me.tbxSMSearch) Then
stDocName = stDocName & " AND ([LastName] = """ & Me.tbxSMSearch & """)"
End If
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_cmdAtlantic_Click:
Exit Sub
Err_cmdAtlantic_Click:
MsgBox Err.Description
Resume Exit_cmdAtlantic_Click
End Sub
I highly doubt that it is....any help is highly appreciated!
I'm working on a database, and I wanted to make a search function on a form. When the user enters a salesman's name, a manager's name or a year, and hits the search button, a query will be thrown, and display the results.
I know how to do this in coldfusion, but, how do I do this in access. Do I write a macro or sometype of script? If so...is this correct?
Private Sub btnSMSearch_Click()
On Error GoTo Err_cmdAtlantic_Click
Dim stDocName As String
Dim stSMQuery As String
stSMQuery = "qrytablebysalesman"
stDocName = stSMQuery
If Not IsNull(Me.tbxSMSearch) Then
stDocName = stDocName & " AND ([LastName] = """ & Me.tbxSMSearch & """)"
End If
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_cmdAtlantic_Click:
Exit Sub
Err_cmdAtlantic_Click:
MsgBox Err.Description
Resume Exit_cmdAtlantic_Click
End Sub
I highly doubt that it is....any help is highly appreciated!