So, you're basically wanting to transfer data
from table "A" to table "B" via the selection from the dropdown?
You'll want to:
1) Add the additional columns from table "A" to the source
(query) for the dropdown.
2) Set up the column properties on the dropdown so the
additional columns can be read via code. Increase the column count to
represent the number of fields you're pulling from table "A". Modify the
column widths so each column has a width, even if it's zero. (You
can't read the value from code unless the column has a
width).
In the dropdown's AfterUpdate event, set the values:
Me.TextField1 = Me.cboDropdown.Column(1)
Me.TextField2 = Me.cboDropdown.Column(2)
Me.TextField2 = Me.cboDropdown.Column(2)
etc., etc.
Keep
in mind that the columns in comboboxes are zero-based, so the first column is
Column(0), the second is Column(1), etc.
'**************************************************'
You need to ask yourself if this is really necessary,
however.
'**************************************************'
Unless there is a valid reason for holding the data from table "A"
separately in table "B", you don't need to do any of this: storing the
PrimaryKey from "A" as a foreign key in "B" will suffice. You can link the
tables together via the keys, which is one of the principals of
normalization.
Hope
that helps you.
Tom Oakes
Personal PC Consultants, Inc.
[EMAIL PROTECTED]
503.230.0911 (O)
402.968.6946 (C)
734.264.0911 (F)
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of David R
Sent: Wednesday, January 04, 2006 11:37 AM
To: [email protected]
Subject: [AccessDevelopers] Form populating multiple fields from one table
Hi
All:
Although I'm not new
to Access I'm stumped on this one. If you can help, Please keep in mind I mainly
use wizards and any reference to VB should be worded "for the complete idiot".
Thanks. I'll try to keep this simple:
1). I have two
tables. One with 10 columns.
2). I have a
form with 1 drop down box and 9 fields.
3). The drop down
box selects one record from table "A" with the "key" being the selected
field filler.
4). After fields on
the form are populated they need to be saved as a new record in Table "B" (Along
with some other unmentioned typed in info)
I would like to
populate the remaining fields with the data from the other columns. I have no
problem filling in the field on the drop down box BUT, I need the syntax
AND method of
finding the remaining column fields and sticking it in the form fields.
Here's a simplified example:
col1 col2
col3 col4
col5
data1
data2 data3 data4
data5
key
===========================
Form:
Field1 Dropdown box
(selects field1's data "key")
FormField2 should be
data2
FormField3 should be
data3
etc........
And ALL should be
saved into table "B"
Can anyone
help....
Thanks
=Dave
R.=
Please zip all files prior to uploading to Files section.
SPONSORED LINKS
| Microsoft access developer | Microsoft access help | Microsoft access database |
| Microsoft access training | Microsoft access training course | Microsoft access programming |
YAHOO! GROUPS LINKS
- Visit your group "AccessDevelopers" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
