Using a form with text input to open form and display record

TrekMietta

Registered User.
Local time
Today, 10:38
Joined
Sep 17, 2009
Messages
26
Okay i need some help if you guys dont mind.

I have a form named customers, i would like to have a seperate form (Not a subfrm) where i can enter the customer number then click a button (search) and it will open the Customers form and display the correct record.

On the same form i wish to have the same thing but instead it should open the Orders form and display the correct record.

How do i do this, i had this working ages ago using a tutorial on a website but i cant find the site or the tutorial.

Please help.
 
Thanks but it doesnt tell me where to enter the "expressions" or "Code" that he gives?? any suggestions?

Regards
Trek
 
Just tried it and it says it "cant find the object Do.cmd"

Regards
 
that means you put the code in the event PROPERTY and not in the VBA window where it needs to go. See this for where to put code for events.
 
today must just not be my day, it now says

"Run time error: 3464
Data type mismatch in criteria expression"

Any ideas, its starting to drive me mad now, been trying to do this for nearly 3 days.

Regards and thank you very much for you help and very quick replies.
Trek
 
Post the code you are using. You are likely either not using delimiters (" for text and # for dates) or are using delimiters with a number field which does not use them.
 
hello,

yes it is searching int field in a table i.e. "123456", here is the code i'm using:

Code:
Private Sub Command3_Click()
    DoCmd.OpenForm "Customers", , , "custno = '" & Me.ipt_custno & "'"
End Sub

Thanks again
 
Because it is a numeric field you do not want the quotes. Try this instead:

DoCmd.OpenForm "Customers", , , "custno = " & Me.ipt_custno
 
Thank you,

It worked straight away, thank you for your patience.

Regards Trek
 

Users who are viewing this thread

Back
Top Bottom