How can Access form display a field in another related table?

G

Guest

Tbl report1 has a key field Rpt Regulated Entity No and a name field Rpt Reg
Entity Name. My data entry form is the Tbl Technical_Databse and has a key
Tech RN No. When the input Tech RN No equals the Rpt Regulated Entity No,
the Rpt Reg Entity Name should "popup" into the next field. This is to let
the user know they have the correct entity. Then they continue to enter data
to be saved in the Tbl Technical_Database. I cannot get the DLookup to work.
I am a beginner in Access, but do understand code - normally. (COBOL)
 
G

Guest

Good, but the form is all done and I was trying a DLookup. So to do a query
, which I've created, how do I assign it as the Record Source? All the
properties show is Control Source. (Told you I was new to this! Thanks for
your patience.)
 
S

Steve Schapel

Hutch,

If you want to persevere with the DLoolup idea, post the expression you
are trying and som3eone may be able to spot where the problem lies.

Control Source is a property of the textbox. Record Source is a
property of the Form itself. Click the little square in the top left of
the design view of the form, where the rulers meet, and then look at the
property sheet.
 
G

Guest

Had the query working for a bit, then I lost ability to input data to be
saved. Trying to fix that, the "form view" is now blank. Design is there,
form is gone. I'll start over. Desired deliverable: I have reference table
for Facility information; a reference table for Distributor information and
have built database (Technical Database) to track technical data input by
user. Technical Database will allow input of Facility number - would then
like Facility name (+address fields) from Facility reference table to appear
on form to visually validate Facility #. Then input more technical data to
be stored in Technical Database. Another section wants Distributor
information. Want to enter Dist # and have Distributor name and status
appear (from Distributor reference) for visual validation. More data entry
to Technical Database to be entered and stored.
Facility Database related to Technical Database by Facility # entry and
storage.
Distributor Database related to Technical Database by Distributor # entry
and storage.
Thanks again for your patience.
 
S

Steve Schapel

Hutch,

Just to facilitate communication, where you mention the word Database, I
think you are referring to Tables.

Also, as another "aside", it is not a good idea to use a # as part of
the name of a field.

I would suggest you use the Column property of a combobox approach, it
is probably easiest to describe. This is mentioned in the article I
referred you to. For example, let's say your Distributor table has
DistNumber as the first field, DistributorName as the second field, and
Status as the third field. So now you have a form bound to the
Technical table. Ok, put a combobox on your form, bound to the
DistNumber field (i.e. this will be the Control Source property of the
combobox). And then set the other properties of the combobox like this...
Row Source: Distributors (the name of your Distributor reference table)
Column Count: 3
Bound Column: 1
Column Widths: 1;0;0
(if you want the drop-down list of the combobox to only show the
DistNumber, or if you want the drop-down list to aslo show the
DistributorName then something like this:)
Column Widths: 1;3;0

Ok, now put an unbound textbox on the form to show the distributor name.
And in the Control Source property put the equivalent of this...
=[DistNumber].[Column](1)
(This assumes that DistNumber is the name of the combobox. Note that
the numbering of the columns starts at 0, so Column(1) is the 2nd
column, i.e. the distributor name).
 
G

Guest

Yes, I mean tables. Having to convert from Pdox where previous users used
"database." And same with "#". If I start over, I'll omit these. Here's
more than you want to know:
DC Technical Application: Database
Tables:
Tbl TECHNICAL_DATABASE (prefix for field names “Techâ€)
Primary Key – Tech RN Number (matches Rpt Regulated Entity No of Tbl report1)
Data entry fields to be saved and maintained in this table.
Tech Mach Status, Tech Mach Status 2nd and Tech Mach Status 3rd use combo
box Tbl DC Machine Status (for consistent data entry)
Tech User ID is combo box from Staff User ID (for consistent data entry)

Tbl report1 (prefix for field names “Rptâ€) (Lookup Table)
Primary Key – Rpt Regulated Entity No – matches Tech RN Number
Use Rpt Reg Entity Name, Rpt RE Street Address, Rpt RE City, Rpt RE State,
Rpt RE Zip, Rpt RE Contact Phone, Rpt CN Customer No, Rpt CN Customer Name,
Rpt RE Bus Type for display purposes only.

Tbl Distributors_Database (prefix for field names “Distâ€) (Lookup Table)
Primary Key- Dist ID# (matches Tech Dist ID # 1st, Tech Dist ID # 2nd and
Tech Dist ID# 3rd of Tbl TECHNICAL_DATABASE
Uses Dist Company Name and Dist Status fields for display purposes only.

Tbl DC Machine Status (combo box table for consistent data entry for fields
Tech Mach Status, Tech Mach Status 2nd and Tech Mach Status 3rd)
Primary Key – Key (1,2,3,…)
Field values: Currently in Use, Permanently out of Use, Temporarily out of
Use, Unknown

Staff User ID (combo box table for consistent data entry for field Tech User
ID)
Primary Key – none
Field Values: various staff initials

Forms:
Frm TechnicalTracking Input -- Data entry form created from all fields in
table Tbl TECHNICAL_DATABASE plus fields for view only from Tbl report1 Rpt
Reg Entity Name, Rpt RE Street Address, Rpt RE City, Rpt RE State, Rpt RE
Zip, Rpt RE Contact Phone, Rpt CN Customer No, Rpt CN Customer Name, Rpt RE
Bus Type for display purposes only.
and Tbl DISTRIBUTORS_DATABASE Dist Company Name and Dist Status for display
purposes only

Desired Deliverable:
1. Enter into Frm TechnicalTracking Input Tech RN Number for storage in
Tbl TECHNICAL_DATABASE and have Rpt Reg Entity Name, Rpt RE Street Address,
Rpt RE City, Rpt RE State, Rpt RE Zip, Rpt RE Contact Phone, Rpt CN Customer
No, Rpt CN Customer Name, Rpt RE Bus Type from Tbl report1 display in
appropriate fields on form for visual verification.
2. Enter into Frm TechnicalTracking Input new technical data fields for
storage in Tbl TECHNICAL_DATABASE.
3. Enter into Frm TechnicalTracking Input Tech Dist ID # 1st (2nd and 3rd)
for storage in Tbl TECHNICAL_DATABASE and have Dist Company Name and Dist
Status from Tbl Distributors_Database display in appropriate fields on form
for visual verification.
4. Enter into Frm TechnicalTracking Input remaining new technical data
fields for storage in Tbl TECHNICAL_DATABASE including repetitive Tech User
ID, Tech Comments Date and Tech Notes/Comments. Staff wants to be able to
append comments to the record as needed without overwriting previous comments.


Steve Schapel said:
Hutch,

Just to facilitate communication, where you mention the word Database, I
think you are referring to Tables.

Also, as another "aside", it is not a good idea to use a # as part of
the name of a field.

I would suggest you use the Column property of a combobox approach, it
is probably easiest to describe. This is mentioned in the article I
referred you to. For example, let's say your Distributor table has
DistNumber as the first field, DistributorName as the second field, and
Status as the third field. So now you have a form bound to the
Technical table. Ok, put a combobox on your form, bound to the
DistNumber field (i.e. this will be the Control Source property of the
combobox). And then set the other properties of the combobox like this...
Row Source: Distributors (the name of your Distributor reference table)
Column Count: 3
Bound Column: 1
Column Widths: 1;0;0
(if you want the drop-down list of the combobox to only show the
DistNumber, or if you want the drop-down list to aslo show the
DistributorName then something like this:)
Column Widths: 1;3;0

Ok, now put an unbound textbox on the form to show the distributor name.
And in the Control Source property put the equivalent of this...
=[DistNumber].[Column](1)
(This assumes that DistNumber is the name of the combobox. Note that
the numbering of the columns starts at 0, so Column(1) is the 2nd
column, i.e. the distributor name).

--
Steve Schapel, Microsoft Access MVP

Had the query working for a bit, then I lost ability to input data to be
saved. Trying to fix that, the "form view" is now blank. Design is there,
form is gone. I'll start over. Desired deliverable: I have reference table
for Facility information; a reference table for Distributor information and
have built database (Technical Database) to track technical data input by
user. Technical Database will allow input of Facility number - would then
like Facility name (+address fields) from Facility reference table to appear
on form to visually validate Facility #. Then input more technical data to
be stored in Technical Database. Another section wants Distributor
information. Want to enter Dist # and have Distributor name and status
appear (from Distributor reference) for visual validation. More data entry
to Technical Database to be entered and stored.
Facility Database related to Technical Database by Facility # entry and
storage.
Distributor Database related to Technical Database by Distributor # entry
and storage.
Thanks again for your patience.
 
S

Steve Schapel

Hutch,

So, did you try my suggestion about the combobox? This would assume, of
course, that when you enter, for example, the Dist ID on the Frm
TechnicalTracking Input form, it would be appropriate to use a combobox
for this. If you want to type the Dist ID into a textbox, then a
different approach will be needed.
 
G

Guest

Yes, but I kept getting all the Dist ID's listed. There are currently 24
Dist ID's in the Distributor table and close to 4,000 Regulated Entities in
the report1 table. So the combo box is okay for Dist, but not for RE. When
I changed the form Record Source, it only recognized the one table, where
this form uses 3. I'm researching foreign keys to see if this might help.
I'd email this stuff to you if it would aid in understanding. Worked in
Paradox so I know it should work in Access.
 
S

Steve Schapel

Hutch,

The reason I am promoting the Combobox approach is because it is simpest
to undertand and get working right. The point is that the form should
only be based on one table, i.e. the Record Source of the form is
TECHNICAL_DATABASE. The controls for the display of the related data
from the other tables should be *unbound* textboxes. The concept here
is that you use a multi-column combobox for the linked field (e.g. Dist
ID) and then an expression (such as the example I gave you
=[DistID].[Column](1) in the Control Source of the unbound textboxes in
order to reference the data from the other columns of the combobox's Row
Source. I am not clear exactly what difficulty you are experiencing
with this idea. I can't see why the number of Regulated Entities should
be a problem.
 
G

Guest

Steve! It's working now. Thank you so very much for your patience and
detailed explanation. I used the Combobox for both since it would still
allow me to do the data entry instead of scrolling down 4000 lines. I am so
pleased with this. Thank you thank you thank you. 11/16/05 11:24AM
Hutch
 
S

Steve Schapel

Hutch,

Very pleased to hear of your success! Best wishes for the rest of the
project.
 

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