Update data to make available on drop-down list on an open form

B

Bethany

I have a form that I made to enter data for numerous
clients and order(s) for each client during a session. A
report is then generated for each client for that
particular session for each order placed.

Each order placed relates to a particular piece of
equipment owned by the client and the report generated
notes the piece of equipment to which the order pertains.
On the main form, there is a drop-down list from which the
equipment must be selected. (The equipment field is an
AutoNumberID but the drop-down list is the description so
the users can make the correct selection).

The information regarding the piece of equipment is not
always available and I currently have a command button
that opens up another form used to enter the equipment
information. However, once the information is entered and
the form closed, the new information is not present in the
drop-down list on the main form.

I don't want to have the main form close during the data
entry session because the users move through the records
and make any final edits before the reports are
generated.

I'm not that experienced with VBA so I tried using a macro
to requery the equipment table but I couldn't get it to
work. What am I doing wrong? Is there an easier way of
updating the equipment information in order to make it
available on the main form's drop-down list?

I need a plain English explanation since I'm pretty new to
Access and I thank you for your assistance in advance.
 
A

Allen Browne

Use the AfterUpdate event procedure of the form where you made the entry to
requery the combo on the original form.

Example:

Private Sub Form_AfterUpdate()
If IsLoaded("MyOtherForm") Then
Forms("MyOtherForm")![MyCombo].Requery
End If
End Sub

Private Sub Form_AfterDelConfirm(Status As Integer)
If Status = acDeleteOk Then
Call Form_AfterUpdate
End If
End Sub

Note: The IsLoaded() function is in the Utiltiy module of the Northwind
sample database.
 

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