Syntax for opening a form with condition

G

Guest

Hi. I need the syntax for opening a form using a condition.
i want to open a form from within another form using a click button.
here is what i have so far
the variable below is given the text box value from the current opened form.
DivCode = txtDiv
This line then opens the form 'frmPs' where the value in PsNum of frmPs =
the variable value.
DoCmd.OpenForm "frmPs", acNormal, , Forms![frmPs]![PsNum] = DivCode,
acFormReadOnly

Many thanks in advance
 
G

Guest

Thanks. That was great

Alex Dybenko said:
Hi,

try:
DoCmd.OpenForm "frmPs", acNormal, , "[PsNum] = " & DivCode

if DivCode is a string - then should be in quotes:

DoCmd.OpenForm "frmPs", acNormal, , "[PsNum] = '" & DivCode & "'"

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

Mike said:
Hi. I need the syntax for opening a form using a condition.
i want to open a form from within another form using a click button.
here is what i have so far
the variable below is given the text box value from the current opened
form.
DivCode = txtDiv
This line then opens the form 'frmPs' where the value in PsNum of frmPs =
the variable value.
DoCmd.OpenForm "frmPs", acNormal, , Forms![frmPs]![PsNum] = DivCode,
acFormReadOnly

Many thanks in advance
 

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