By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,705 Members | 1,363 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,705 IT Pros & Developers. It's quick & easy.

Combo box Search Problem

P: 67
Hello all

I am trying to create a search form. I have a table called tblContact which has the field for postcodes in it. I have another table called tblSales which i have created a query to link the tblContacts to. On the frmSales the Postcode is a combo box. I am using the code below to search for the postcodes. I can't get it to find a postcode via the combo box. Sorry if i am not being very clear as my coding is very basic. Please help, thanks.

Private Sub btnSearch_Click()
Dim strSearch As String

If IsNull(Me![PostcodeSearch]) Or (Me![PostcodeSearch]) = "" Then
MsgBox "You Must Enter A Postcode!", vbOKOnly, "Invalid Search!"
Exit Sub
End If

DoCmd.GoToControl ("Postcode")
DoCmd.FindRecord Me!PostcodeSearch

strPostcodeRef = Postcode.Text
strSearch = PostcodeSearch.Text

If strPostcodeRef = strSearch Then
MsgBox "Match Found For: " & strSearch, , "Match Found!"
PostcodeSearch = ""

MsgBox "No Match For: " & strSearch & " - Please Try Again.", _
, "No Match Found!"
End If
End Sub
Oct 2 '08 #1
Share this Question
Share on Google+
1 Reply

P: 67
Hi again

The problem isn't the combo box as when i link the tblContact direct to the control source it works fine. so its linking through a query where i am having the trouble. Please advise. Regards
Oct 2 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.