Form field update based off of previous field

  • Thread starter Thread starter Andrew Tatum
  • Start date Start date
A

Andrew Tatum

Alright. First and foremost I truly appreciate all your help recently.
I'm working on a project and this group has been a lifesaver!

I have a form that contains:

Date
CompanyID
InvoiceID
Amount

It is created off of the PaymentsReceived table. In the table, there is
a Combo box look up for CompanyID and InvoiceID.

Basically, on the form if Company 1 is selected I would want the
InvoiceID drop down box to display only Invoices that relate to
CompanyID.

Thanks guys!
 
These are called cascading combo boxes and in the Row Source of the second
combo box, you need to reference the first. Something like:

Select InvoiceID from PaymentsReceived where CompanyID =
forms!TheForm!Combo1

Where the form is named TheForm and the first Combo is named Combo1.

Also, in the After Update event of Combo1, you need to have something like:
Me.Combo2.Requery

On my website (www.rogersaccesslibrary.com), is a small Access database
sample called "CascadingComboBoxes.mdb" which illustrates how to do this.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Thanks!

So I have this so far:

Private Sub CompanyID_AfterUpdate()
Me!InvoiceID = Null
Me!InvoiceID.Requery
End Sub

For the second ComboBox, I have this:

SELECT PaymentsReceived.InvoiceID
FROM PaymentsReceived
WHERE
(((PaymentsReceived.CompanyID)=[forms]![PaymentsReceived]![CompanyID]));

When I then look at the form... the second drop down box is blank :(.
Any ideas?
 
Thanks!

So I have this so far:

Private Sub CompanyID_AfterUpdate()
Me!InvoiceID = Null
Me!InvoiceID.Requery
End Sub

For the second ComboBox, I have this:

SELECT PaymentsReceived.InvoiceID
FROM PaymentsReceived
WHERE
(((PaymentsReceived.CompanyID)=[forms]![PaymentsReceived]![CompanyID]));

When I then look at the form... the second drop down box is blank :(.
Any ideas?
 
Just wanted to update. For some reason the subject of this message was
changed to something about a test... so I don't think anyone saw this
message....
 
Do you mean there are no selections available for the invoice box or
just that it appears empty after you have selected a company?
 
Back
Top