How do i use a command button to search for a number in a text box.

  • Thread starter yomi m via AccessMonster.com
  • Start date
Y

yomi m via AccessMonster.com

I have a text box called txtSearch, and a cmd button named Search Number.
What i want to do is enter in a number, if the number is found in my table,
called Issues/Decicions, generate a persons first name and organization based
on the number in that table in another form called Search Number in
designated text fields. I had this code working before and screwed aroud
with it now it doesn't run. This is what i had.

Private Sub Search_Contacts_Click()
On Error GoTo Err_Search_Contacts_Click


Dim DocName As String
Dim LinkCriteria As String

If IsNull(Me![txtSearch]) Then
MsgBox ("You must enter in a contact number to proceed.")
Exit Sub
End If

DocName = "Search Number"
LinkCriteria = "[txtSearch] = Forms![Issues/Decisions Form]![txtSearch] "
DoCmd.OpenForm DocName, , , LinkCriteria


Exit_Search_Contacts_Click:
Exit Sub

Err_Search_Contacts_Click:
MsgBox Err.Description
Resume Exit_Search_Contacts_Click

Can i just go to the tools relationship feature and join txtsearch to the
contact number field in my issues/decisions table? It worked before and it
generated the corresponding data with that number.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top