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

Simple query to search two fields and return matched record

Status
Not open for further replies.

Kenny2003

Technical User
Dec 29, 2002
53
GB
Hi gang,

For some bizzare reason I am having terrible trouble setting up a simple query.

I want to have a form where the user types two values into two text boxes (FirstName and LastName)and the user then clicks a command button. When they do access will open another form that shows the appropiate record. For example: the user types the first name in the first name box "Elvis" and then the same in the last name box "Presley" and when they click the button, up pops the info form that displays the information for elvis presley.

Here is my db setup

Table name = tblMemberInfo
Field 1 = mbrID (Unique Auto number)
Field 2 = mbrFirstName
Field 3 = mbrLastName
Field 4 = mbrAddress
Field 5 = mbrEmergencyContactName
Field 6 = mbrEmergencyContactTelephone

Any pointers or help would be great, I have spent all weekend searching the forums and trying different code but I can not get this to work despite it being a very basic search. I would learn a lot if you could help me out.

Thank you for your time and help.

Kenny
 
Hi
How about:
Code:
DoCmd.Openform "[i]ResultFormName[/i]",,,"mbrFirstName='" & [i]Me.txtFirstName[/i] & "' And mbrLastName = '" & [i]Me.txtLastName[/i] & "'"

Where the results form is bound to tblMemberInfo. You could also use OpenArgs.
However, to me, this is just too much like work. I would not have two forms when it seems that one would do. :)
 
Hi Remou,

What can I say except Thank You, your suggestion was exactly what I was looking for and worked first time.

Thank you again,

Kenny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top