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

Reloading subform on record change

Status
Not open for further replies.

asenft

Programmer
Apr 24, 2001
52
US
What I am trying to figure out is how I can have a subform reload itself when a user clicks a button that is basically a record selector. So that when they click the button to go to a different record, the subform will reload with the data from that new record.

My subform loads different object labels based on a value on the main form, so I need it to reload with the new values when the user selects a different record in the database. Anyone have any idea how i could do this?
Thanks.

Aaron
 
Well that's built into Access

You need a unique ID field that is both on th esubform and the main form this is waht the two "sync" to

On the subform Properties is a
the "Link Child field" and "Link master field"

Now thye can be differnt on each form but if you have record ID which is a number of 299233
then the subforms table has to be the same number 299233

A good example of this is an Invoice
the main form has the Invoice number, Date the customer and address.
the sub form is linked by Invoice number and has part Inovice Number, part number, description, and qty and price

Main table
Invoice Number Date Customer
299233 7/24/01 Fred Smith

Invoice Details table
Invoice Number Part Number Qty
299233 L-233-r 3
299233 G-2992-F 1
299233 D-3002-a 2


So if your tables are set up correct Access will make the connections for you.

OK

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
Doug-
Thanks for the reply, but thats not exactly what i meant. That will work if I was just refreshing data on the form, but my form is dyamically built in the onLoad() function. It names and creates the labels for the checkboxes on it depending on the value of Contact_Type on the main form. So when i click the button that goes to another record, i need the subform to be reloaded based on the new value in Contact_Type.

Aaron
 
I just guessing here, but perhaps you could move the code from the onload event into the on current event of the main form. Then just do a me.refresh of the sub form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top