Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database Search

Status
Not open for further replies.

skip49401

Technical User
Mar 18, 2003
3
US
I am using the following code to simply search through a database (Jobs) with a form and open a new form (Jobs)containing the information that I search for. The problem is when I open the search form (say I enter: dog) I get a text box that says "Enter parameter value", so if I enter dog again my information will come up in the new form. But if I enter "dog" with the parenthesis around it, it works fine. I don't know how to do it without needing the parenthesis. Thanks!

Private Sub cmdLaunchTransactionReport_Click()
On Error GoTo Err_cmdLaunchTransactionReport_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim sCriteria
sCriteria = "[JobName]=" & txtJobName
stDocName = "Jobs"
DoCmd.OpenForm stDocName, acNormal, , sCriteria, acFormEdit
Exit_cmdLaunchTransactionReport_Click:
Exit Sub
Err_cmdLaunchTransactionReport_Click:
MsgBox Err.Description
Resume Exit_cmdLaunchTransactionReport_Click
End Sub
 
Try changing your code to this:

sCriteria = "[JobName]='" & txtJobName & "'"
 
I changed the code as you posted it, it did succeed in getting rid of the "Enter Parameter Value" but the form comes up blank. So it must be searching for something that is not there huh?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top