search

P

p16458

Hi guys,

I have a combo box on form1 in which I will type Client ID to search for
that client information on form2.
For example in combo0 i type Client ID is : Lopez0001 (form1)
And I only need the information on that ID: Lopez0001 pop up (form2)
I am using Access 2000

Any help I would really appreciate.

Kim
 
A

AY

try this


Dim stLinkCriteria As String
stLinkCriteria = "[customercode]=" & "'" & Forms![form1]![CustomerCode]
& "'"
DoCmd.OpenForm ("form2"), acNormal, , stLinkCriteria, acFormReadOnly,
acDialog
 
P

p16458

Thanks so much for your quick response. Where do I add the code? behind combo
box? thanks again

AY said:
try this


Dim stLinkCriteria As String
stLinkCriteria = "[customercode]=" & "'" & Forms![form1]![CustomerCode]
& "'"
DoCmd.OpenForm ("form2"), acNormal, , stLinkCriteria, acFormReadOnly,
acDialog

p16458 said:
Hi guys,

I have a combo box on form1 in which I will type Client ID to search for
that client information on form2.
For example in combo0 i type Client ID is : Lopez0001 (form1)
And I only need the information on that ID: Lopez0001 pop up (form2)
I am using Access 2000

Any help I would really appreciate.

Kim
 
P

p16458

I tried and got an error message: Run-Time Error '2465'. Here is the copy of
the code (I changed [customercode] into [borrowerID] ) (this code i put
behind the combo box)

Option Compare Database

Private Sub Combo0_Click()

Dim stLinkCriteria As String
stLinkCriteria = "[BorrowerID]=" & "'" & Forms![Form1]![BorrowerID] & "'"
DoCmd.OpenForm ("Form2"), acNormal, , stLinkCriteria, acFormReadOnly, acDialog

End Sub



Thank you very much
Kim
 
S

scubadiver

You don't need to use form1 to search for info on form2. You can use a
search box with a button to look for a client ID on form2. I have tried to
search for the thread where I originally found this out but I can't see it.
 
A

AY

To add a search box in Form2 just add a find record button.

However if your need is Form1 and Form2 as in the case example of getting
more detail info from another table. try using the code at the double_click
or afterupdate.

You can also put the code behind a button and click it after you make a
selection.
 

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