RE: If one value then fill out other values

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Hey!!!

Thanks for your response!! I think i get it except for the very first part:

You do that by filtering the Client combo row source on the value in the >Company Combo. You will want the bound column of the Company Combo to be the CompanyID.

:O Please can you explain that in english? :)

Cheers mate!

"Klatuu" wrote:

The first thing you asked is called Cascading combos. You do that by
filtering the Client combo row source on the value in the Company Combo. You
will want the bound column of the Company Combo to be the CompanyID. Then in
the After Update event of the Company Combo, you requery the Client Combo:

Private Sub cboCompany_AfterUpdate()
Me.cboClient.Requery
End Sub

Then to populate the controls on the form with the client info, you use the
After Update event of the Client combo. To have the values available,
include all the fields from tblClient you want to use in the combo's row
source. You can set the column widths property so that only the Client Name
shows in the list. The row source would be like:
SELECT ClientID, ClientName, ClientEmailAddress, ClientContractNumber FROM
tblClient WHERE autCompanyID = Me.cboCompany;

Private Sub cboClient_AfterUpdate()

With Me
.txtClientID = .cboClient.Column(0)
.txtClientName = .cboClient.Column(1)
.txtClientEMail = .cboClient.Column(2)
.txtClientContact = .cboClient.Column(3)
End With
--
Dave Hargis, Microsoft Access MVP


"ant1983" wrote:

I have the following tables with the following (simplified) structures:

tblCompany
- autCompanyID
- txtCompanyName
- txtCompanyCountry

tblClient
- autCompanyID (linked to above table)
- autClientID
- txtClientName
- txtClientEmailAddress
- txtClientContactNumber

What I want to achieve is to have a form where, when I select the Company
Name from a drop down box another drop down box, txtClientName, should be
populated with only the clients within that company.

That’s the first thing I want. The 2nd is to, when a Client Name is
selected this should fill out the remainder of the fields. i.e. if John
Smith was selected then John Smith’s Email Addy and Contact number should be
filled out.

I don’t even know where to start!!! Pls help!! Much appreciated!!!!
.



Relevant Pages

  • RE: If one value then fill out other values
    ... you filter the query that is the row source for Combo2 using the ... the After Update event of the Company Combo, you requery the Client Combo: ... tblClient WHERE autCompanyID = Me.cboCompany; ... Name from a drop down box another drop down box, txtClientName, should be ...
    (microsoft.public.access.modulesdaovba)
  • RE: If one value then fill out other values
    ... filtering the Client combo row source on the value in the Company Combo. ... the After Update event of the Company Combo, you requery the Client Combo: ... tblClient WHERE autCompanyID = Me.cboCompany; ... Name from a drop down box another drop down box, txtClientName, should be ...
    (microsoft.public.access.modulesdaovba)
  • Re: conditionally visible subforms?
    ... For example a client is an agent or is not. ... attributes that get their own field in tblClient: ... The design of the subform should be such that it is only about twice ...
    (microsoft.public.access.gettingstarted)
  • RE: If one value then fill out other values
    ... numCompanyClient (Lookup from 1st table ABOVE) ... It should be in the table "tblCompanyClientContact". ... Select a company, then select a client. ... tblClient WHERE autCompanyID = Me.cboCompany; ...
    (microsoft.public.access.modulesdaovba)
  • Re: Find feature
    ... <MS ACCESS MVP> ... Here's the Record Source for tblClient. ... "Ken Snell MVP" wrote: ... and look at the Client info for that record. ...
    (microsoft.public.access.formscoding)