Linking subforms

cardgunner

Registered User.
Local time
Today, 15:21
Joined
Aug 8, 2005
Messages
210
I have 2 subforms in my main. in Sub1 I have a field alt_id and it's set as an auto number. I placed a text box, Text16, in main and set it's control source to be sub1!alt_id.

In Sub2 i linked main.bpid to sub2.bpid and main.text16.value to sub2.alt_id.

However i need to refresh sub2 in order to display the records that are linked. What I have to do is click into the subform and hit rrefresh all.

I would like to set sub1 to refresh sub2 anytime the record changes. So I go from record 1 to record 2 in sub1 then sub2 will refrsh and show it's contents in relation to sub1.
 
Replace the text in red:

Code:
Forms![COLOR=red]MainFormName[/COLOR]![COLOR=red]SubForm[B]Object[/B]Name[/COLOR].Form.Requery
 
Do I paste that into an event? Which event OnGotFocus?
 
Try the after update event of the subform which you want to fire the requery.

If you want to test which event is best replace try using soemthing like this:

Code:
msgbox "Event fired"

That way you can make sure the event is firing the code exactly when you want it to (and keep in mind you can place it in more than one event if you need to).
 
Sorry, I'm not doing something right

Code:
Private Sub Form_GotFocus()

    [COLOR="Red"]Forms!Register!2011_attendee_contact.Form.Requery[/COLOR]    
    MsgBox "Event fired"
    
End Sub
 
That's not right.

For subform2, type in (i.e. don't click the elipsis button) these values into these properties:

Link Master Fields: Text16
Link Child Fields: [alt_id]

Delete your Got Focus event.
 
How did you link it? A requery is not necessary.

I linked sub2.bpid=main.bpid and sub2_slt_id=main.textbox16.value

textbox16 control source is set to sub1.alt_id

This form is going to get used to rgister company's at an event

In the main form the client searchs for the customer and bring into the form the info. If the info is incorrect, or if the customer is new, new info,or corrected, is generated into sub1.

Then the personnel contact info is recorded in sub2.

Our present customers have a bpid. New Customers do not but I'm assigning them a Alt_id. They will need to be entered into our mother system at a later date.

However I need to associate the new customer contact with the alt_id. And present customer contact with bpid.
 
Hey, that worked.

master: bpid;textbox16
child: bpid;[Alt_id]

Nice! Thank you.

That's not right.

For subform2, type in (i.e. don't click the elipsis button) these values into these properties:

Link Master Fields: Text16
Link Child Fields: [alt_id]

Delete your Got Focus event.
 

Users who are viewing this thread

Back
Top Bottom