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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search on a form to affect Records on Mainform

Status
Not open for further replies.

kamfl610

Programmer
Apr 15, 2003
90
US
Hi all,

Got a question on a search criteria. On the mainform, i have a search button which brings up a Search form. Now what I want to do is have the user put their value in and then when they click on the Search button on the Search form to automatically move and affect the Mainform. I'm having problems with the code because it keeps asking for an object. Now here is the code in the Search form:

Private Sub cmdSearch_Click()

On Error GoTo Err_cmdSearch_Click
If txtContract Is Null Or txtContract = Empty Then
strmessage = MsgBox("You must enter a Contract Number to search with.", vbOKOnly)
Else
Form_DOECIT![Contract Num].SetFocus
DoCmd.FindRecord txtContract
End If

Exit_cmdSearch_Click:
Exit Sub

Err_cmdSearch_Click:
MsgBox Err.Description
Resume Exit_cmdSearch_Click

End Sub

Help is great. Thanks!
 
And I do not want to use a filter. The user still needs access to all the records on the mainform.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top