Open Form with Field from SubForm

R

Ripper

I am attempting to open a form [frmDhallAddDisc] and populate it with the
data associated with a field from the subform I am currently using.

I actually use the field's OnClick event to update several fields on the
current subform and then save the record associated with tblDiscipline. Then
I attempt to pass the DhallID (Primary Key from the record in tblDhall) to
the other form.

What I want is for the new form to open with the information from that
record already loaded. I did pass the Primary Key to it. Below is the code
I use:

Me!AdminDate = Format(Now(), "Short Date")
Me!AdminTime = Format(Now(), "hh:mm AMPM")
Me.Action = "Detention #" & [DHallID] & " Recycled on:" & Date & " Student
has 7 days to serve."
Me.Updated = True
Me.Recycled = True
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.OpenForm "frmDhallAddDisc", , , , , , [DHallID] = Me.DHallID

When I attempt to open the form it is populated with the first record from
tblDhall and not the record from tblDhall I wanted. The DhallID saves
correctly in the tblDiscipline record before it is passed. So how can I
affect the form to open with the selected record loaded?
 

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