Open Form with subform Values

R

Ripper

Access 03 200 format

Using an OnClick event from a text box, I open a new form (frmDHall-Add)
from a subform (frmDiscipline!subDisciplineReferral). I want to pass 2
values to frmDhall-Add from the subform LocID (6 digit number) and DhallID
(AutoNum).

I tried using the docmd.openform DoCmd.OpenForm "frmDhallAddDisc", , ,
"[DHallID] =" & Me.[DHallID] and "[LocID] =" & Me.LocID

Neither value populates the new form that is opening. Does anyone know why?
 
S

Stuart McCall

Ripper said:
Access 03 200 format

Using an OnClick event from a text box, I open a new form (frmDHall-Add)
from a subform (frmDiscipline!subDisciplineReferral). I want to pass 2
values to frmDhall-Add from the subform LocID (6 digit number) and DhallID
(AutoNum).

I tried using the docmd.openform DoCmd.OpenForm "frmDhallAddDisc", , ,
"[DHallID] =" & Me.[DHallID] and "[LocID] =" & Me.LocID

Neither value populates the new form that is opening. Does anyone know
why?

Well for one thing your syntax is a bit off. The keyword AND ought to be
inside quotes:

"[DHallID] =" & Me.[DHallID] & " and [LocID] =" & Me.LocID

But when you say LocID is a 6 digit number, it makes me suspect that it's a
text field. If that's the case then you need to surround the Me.LocID value
in quotes:

"[DHallID] =" & Me.[DHallID] & " and [LocID] = '" & Me.LocID & "'"
 

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