Linking a field on two forms

M

Mark

I am in the process of creating a databse to allow our IT dept to put onr
daily schedules online. I have two tables, tblSCHEDULE and tblTIME. The
first table holds the date of the schedule with a primary key of ScheduleID.
The second table links to the first table via ScheduleID. I need to be able
to open the second form, frmTIME_Update to open up and populate the
ScheduleID field on the form for the current record. I have tried using the
form as a subform, however, I have to have two other subforms linked to the
frmTIME_Update form and don't know which way to go. I have tried using the
OpenArgs to pass the value to the second form; but that has failed to work
also.

I am using Access 2003 and will be creating the BE/FE form for use in our
network envirionment. Any help would be greatly appreciated. Thank you in
advance.
 
M

Marshall Barton

Mark said:
I am in the process of creating a databse to allow our IT dept to put onr
daily schedules online. I have two tables, tblSCHEDULE and tblTIME. The
first table holds the date of the schedule with a primary key of ScheduleID.
The second table links to the first table via ScheduleID. I need to be able
to open the second form, frmTIME_Update to open up and populate the
ScheduleID field on the form for the current record. I have tried using the
form as a subform, however, I have to have two other subforms linked to the
frmTIME_Update form and don't know which way to go. I have tried using the
OpenArgs to pass the value to the second form; but that has failed to work
also.

I am using Access 2003 and will be creating the BE/FE form for use in our
network envirionment. Any help would be greatly appreciated. Thank you in
advance.


With a subform, the Link Master/Child properties take care
of all that.

For separate forms, using OpenArgs is the way to go. If
ScheduleID is a Text or Number type field:
DoCmd.OpenForm "frmTime", OpenArgs:= Me.ScheduleID

The code in frmTime's BeforeUpdate (or Dirty event if the
user needs to see the value) would simply be:
Me.ScheduleID = Me.OpenArgs

If ScheduleID is a Date field, the code would be:
DoCmd.OpenForm "frmTime", _
OpenArgs:= Format(Me.ScheduleID, "\#m\/d\/yyyy\#")
and
Me.ScheduleID = CDate(Me.OpenArgs)
 
M

Mark

Marshall,
Thank you for your response. It was right on the money. I had the
format wrong for OpenArgs when I tried it earlier. Your explanation helped
me locate the problem and resolve it.
 

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