I try to open a form through a criteria set in a dialog box:
DoCmd.OpenForm "Form1",,,"[Name]=Forms![Dialog]![Name] and ([Date]=Between Forms![Dialog]![Begining Date] and Forms![Dialog]![End Date])"
Mike Rohde
rohdem@marshallengines.com "If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
DoCmd.OpenForm "Form1",,,"[Name]= '" & Forms![Dialog]![Name] & "' AND [Date] >= #" & Forms![Dialog]![Begining Date] & "# AND [Date] <= #" & Forms![Dialog]![End Date] & "#" Mike Rohde
rohdem@marshallengines.com "If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
Thanks Mike.
It does work. However, though I set the form properties default view and view allowed in datasheet, the form is opened in singel form view though.
Let me know if there's something else needed in the code.
If I understand correctly and you want to open it in datasheet view, try this:
DoCmd.OpenForm "Form1", acFormDS ,,"[Name]= '" & Forms![Dialog]![Name] & "' AND [Date] >= #" & Forms![Dialog]![Begining Date] & "# AND [Date] <= #" & Forms![Dialog]![End Date] & "#" Mike Rohde
rohdem@marshallengines.com "If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
One more thing I forget to mention though,
the form1's date is already formatted. Should I then format the date in the dialog box (if it's possible), or do the format in the code? How?
I would format the date in your dialog box using an input mask. Go to properties of the text box and click the "..." next to input mask. The wizard will help you set it up from there. Mike Rohde
rohdem@marshallengines.com "If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.