skarz
10-04-2001, 07:06 AM
Ok, I've created a form (frmSearch) to lookup contacts. I created a text control (txtSearchStringCompany) for users to enter a company name. I created a query (qryCompanyToDisplay) and set the critera of the company field to [Forms]![frmSearch]![txtSearchStringCompany]. I then created another form (frmCompanyToDisplay) and set (qryCompanyToDisplay) as the Record Source. Next I created a command button in the frmSearch and set it to open frmCompanyToDisplay. The event procedure for this button looks like this:
Private Sub cmdCompanyLookup_Click()
On Error GoTo Err_cmdCompanyLookup_Click
Dim stDocName As String
stDocName = "frmCompanyToDisplay"
DoCmd.OpenForm stDocName, acNormal, acEdit
Exit_cmdCompanyLookup_Click:
Exit Sub
Err_cmdCompanyLookup_Click:
MsgBox Err.Description
Resume Exit_cmdCompanyLookup_Click
End Sub
When I open the form, enter a company name and click the lookup button, a box prompts me to Enter Parameter Value. There is a text box with tblContacts.ID above it. Why won't it open frmCompanyToDisplay with the record for the company I entered in it? I obviously did something wrong but I have no idea what. Can you help me?
Sorry for the long post.
Private Sub cmdCompanyLookup_Click()
On Error GoTo Err_cmdCompanyLookup_Click
Dim stDocName As String
stDocName = "frmCompanyToDisplay"
DoCmd.OpenForm stDocName, acNormal, acEdit
Exit_cmdCompanyLookup_Click:
Exit Sub
Err_cmdCompanyLookup_Click:
MsgBox Err.Description
Resume Exit_cmdCompanyLookup_Click
End Sub
When I open the form, enter a company name and click the lookup button, a box prompts me to Enter Parameter Value. There is a text box with tblContacts.ID above it. Why won't it open frmCompanyToDisplay with the record for the company I entered in it? I obviously did something wrong but I have no idea what. Can you help me?
Sorry for the long post.