Updating recordset when navigating between forms

B

BruceM

I have a Vendor database. Vendor information is stored in a table
(tblVendor). A subset of vendors is approved vendors (who are used for
production-related supplies rather than, say, office supplies). A Boolean
field in tblVendor distinguishes approved vendors from others, and a query
(qryApprovedVendor) uses the Boolean field as a parameter. There is a Main
vendor form based on tblVendor and an Approved vendor form based on
qryApprovedVendor (the information displayed in the two forms is quite
different, which is why there are separate forms).

I have a command button on each form to switch to the other form. The
button sets OpenArgs to the SupplierID number, and the Load event of each
form uses OpenArgs to go to the record being displayed in the other form. A
Main form record may not be an Approved vendor, in which case the
ApprovedVendor form opens to the first record.

I can explain further if needed, but I don't want to clutter this post with
unnecessary detail. The problem I am trying to solve is that if I am at the
Main form and I check the box (the Boolean field) to indicate the vendor is
to be an Approved Vendor, then click the button to go to the Approved Vendor
form, that vendor does not appear on the Approved Vendor form unless I sort
or filter the data, or I close and reopen the ApprovedVendor form. How can
I have the changes in one form show up immediately in the other? I can't
figure out where to requery, if that is what needs to happen, perhaps
because of the OpenArgs in the Load event.
 
R

ruralguy via AccessMonster.com

You simply need to save the record before opening the other form. In the
code behind the button that opens the other form add:
If Me.Dirty Then
Me.Dirty = False
End If

...before you open the next form
 
B

BruceM

Wow! And so obvious once I saw it. Well, it's not the first time I've
over-complicated something. Thanks for the pointer.
 

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