Search subform, goto record on main form.

S

suguy

I have a main form with Customer Info, and a subform with invoices.. they are
linked with the custID.

I would like a 'goto invoice' text box.. This would when cmdGoTo is clicked
take the value of the text box, search the subforms InvoiceID field and show
this record, AND update so the customer info record is correct on the main
form. Is there any easy way of doing this? If i was to just perform a search
on a subform, will it still update the main form on a requery? hmm help! any
ideas

R.
 
E

Evi

I couldn't see the reply to this. It seems to have got missed.
Finding a record in the subform should not be a problem. See if you can see
where to put your own form, subform and control names in the code below

Dim frm as Form
Dim MyInvoice As Long
'assumes InvoiceID is a number field

If Not IsNull(Me.NameOfYourTextBox) Then

MyInvoice = Me.NameOfYourTextBox
Set frm = Forms!NameOfMainForm.NameOfSubform.Form

frm.RecordsetClone.FindFirst "[InvoiceID]=" & MyInvoice

frm.Bookmark = frm.RecordsetClone.Bookmark

'goes to record in subform



End if



But the next bit didn't make sense

"AND update so the customer info record is correct on the main form"



Update what?

Evi
 

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