Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lost in Code 1

Status
Not open for further replies.

TTThio

Programmer
May 3, 2001
185
US
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])"

Thanks for the help.

Tin Tin
 
I believe this is correct....

DoCmd.OpenForm &quot;Form1&quot;,,,&quot;[Name]= '&quot; & Forms![Dialog]![Name] & &quot;' AND [Date] >= #&quot; & Forms![Dialog]![Begining Date] & &quot;# AND [Date] <= #&quot; & Forms![Dialog]![End Date]) & &quot;#&quot;

Mike Rohde
rohdem@marshallengines.com
&quot;If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!&quot;
 
Sorry, had a stray parentheses:

DoCmd.OpenForm &quot;Form1&quot;,,,&quot;[Name]= '&quot; & Forms![Dialog]![Name] & &quot;' AND [Date] >= #&quot; & Forms![Dialog]![Begining Date] & &quot;# AND [Date] <= #&quot; & Forms![Dialog]![End Date] & &quot;#&quot; Mike Rohde
rohdem@marshallengines.com
&quot;If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!&quot;
 
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 &quot;Form1&quot;, acFormDS ,,&quot;[Name]= '&quot; & Forms![Dialog]![Name] & &quot;' AND [Date] >= #&quot; & Forms![Dialog]![Begining Date] & &quot;# AND [Date] <= #&quot; & Forms![Dialog]![End Date] & &quot;#&quot; Mike Rohde
rohdem@marshallengines.com
&quot;If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!&quot;
 
Yes it works. Thanks a lot.

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?

Thanks again
 
I would format the date in your dialog box using an input mask. Go to properties of the text box and click the &quot;...&quot; next to input mask. The wizard will help you set it up from there. Mike Rohde
rohdem@marshallengines.com
&quot;If builders built buildings the way programmers wrote programs, the first woodpecker to come along would destroy civilization!&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top