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

Combo Box to populate a form

Status
Not open for further replies.

smack317

IS-IT--Management
Apr 30, 2003
13
US
ok heres my problem i want to use a combo box, which shows the clientid, lastname, firstname, to populate a form.

the form consists of multiple tables of information like: client, client address, and so on

the clientid last name and first name come from the client table

how do i code it to where i can click in a clientid in the cbo box and put the information about that client on the form...keeping in mind that i need it to pull info from multiple forms but they are all connected with the clientid field?
 
Are you really pulling info from mutliple FORMS - or from multiple TABLES ?


All the code needs to be in the cboControl_AfterUpdate event

Then simply open a recordset on each source table WHERE ClientId = vaule needed
Then populate the controls on the form from the fields in the recordset.





G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
yes its tables my mistake and i didnt understand that at all, sorry
 
Do you know how to open a recordset on a table ?

If not:
What version of Access are you working on ( becuase it makes a big difference )

Tell me the structure of a table with the data
Underline Table Name
Bold Primary Key
Italic Foreign Keys


I'll then do you an example.




G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
Office XP

tables = Client, Client Address,Client Family
primary & foriegn = client id
 
Tell me the structure of a table with the data
Underline Table Name
Bold Primary Key
Italic Foreign Keys
Other fields in normal type



G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
client table has client id , first name, and last name
client id is primary key
 
So
Client
ClientId
FirstName
LastName

and what version of Access are you running ?




G LS
accessaceNOJUNK@valleyalley.co.uk
Remove the NOJUNK to use.
 
[yinyang]


You could set up a query to bring through all of the information using the clientID field to link all the tables, so you have a single source of information. Next, design a form based on this query, with all of the required fields except the combobox. The combobox that you want to use you should be added from the toolbox, making sure the control wizard is on (the wand icon). This allows you to set up a combobox that will bring in the information based on the combobox's data input.

For safety you should turn off the record selection on the form, via the form's properties, so that users can't update a different record without using the combobox to select it(the combobox doesn't update it you navigate this way unless you write some code for it).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top