loading a unbound form from a table

G

Guest

I want to load several fields in an unbound form with data from a table. In
one field, I have a drop down box for the user to select a specific record.
Based on their selection, I would like to populate other fields in the form
with data from a sepcific table.

Currently, I open and select the appropriate table and then find the correct
record, so I know I'm sitting in the correct row in the correct table.

The other twist to this is that there may be multiple records so I would
have to search through the table to find the correct record based on other
criteria.

Here is the code I have so far:

DoCmd.OpenTable ("Units"), acViewNormal, acEdit
DoCmd.SelectObject acTable, "Units"
DoCmd.FindRecord tmprec, acEntire, , acSearchAll, , acAll

tmprec is the selection the user makes. I'm very new to programming in
Acces and appreciate all of the help. How do I load variables from fields in
the "Units" table. Once I get them into variables, I can load them into the
form. I'm just having issues getting the variables loaded.

Thanks again for all of the help............
 
J

John Mishefske

JT said:
I want to load several fields in an unbound form with data from a table. In
one field, I have a drop down box for the user to select a specific record.
Based on their selection, I would like to populate other fields in the form
with data from a sepcific table.

Currently, I open and select the appropriate table and then find the correct
record, so I know I'm sitting in the correct row in the correct table.

The other twist to this is that there may be multiple records so I would
have to search through the table to find the correct record based on other
criteria.

Here is the code I have so far:

DoCmd.OpenTable ("Units"), acViewNormal, acEdit
DoCmd.SelectObject acTable, "Units"
DoCmd.FindRecord tmprec, acEntire, , acSearchAll, , acAll

tmprec is the selection the user makes. I'm very new to programming in
Acces and appreciate all of the help. How do I load variables from fields in
the "Units" table. Once I get them into variables, I can load them into the
form. I'm just having issues getting the variables loaded.

Thanks again for all of the help............

Unbound forms require a bit of advanced programming. The Access "model" is to use bound
forms so you need to do more programming to make this work.

You'll need to read a record each time the user moves to a new record (however they do
that in your UI). This is done with the RecordSet object and then assigning the value to
the appropriate control. Then you'll need to determine what (and if any) changes were made
so that you can write the changes to the appropriate table(s).

You could use either SQL or a RecordSet object to do this.
 

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