By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,136 Members | 1,698 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,136 IT Pros & Developers. It's quick & easy.

Openform criteria

P: n/a
I am trying to;

Click on a textbox in a form called frmcalendar to open another form
petalplanning
(I can do that bit). However I want the form to open at a certain
record depending on the date in a textbox (called date8) on
frmcalendar. (Eg date8 in frmcalendar is to match the date in the
record called plandate in the petalplanning form)

I thought i would be able to do it this way but my criteria is wrong
DoCmd.OpenForm (petalplanning,acNormal, ,"plandate =
Forms!frmCalendar!date8")

Any suggestions how I can correct this? Thanks

Dec 10 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
"keri" <ke*********@diageo.comwrote in message
<11*********************@n67g2000cwd.googlegroups. com>:
I am trying to;

Click on a textbox in a form called frmcalendar to open another form
petalplanning
(I can do that bit). However I want the form to open at a certain
record depending on the date in a textbox (called date8) on
frmcalendar. (Eg date8 in frmcalendar is to match the date in the
record called plandate in the petalplanning form)

I thought i would be able to do it this way but my criteria is wrong
DoCmd.OpenForm petalplanning,acNormal, ,"plandate =
Forms!frmCalendar!date8"

Any suggestions how I can correct this? Thanks
You will need something more along the following lines

DoCmd.OpenForm "petalplanning", acNormal, ,"plandate = #" & _
Format$(Me!date8, "yyyy-mm-dd) & "#"

where "plandate" is the name of a field in the recordsource of the
petalplanning form, and this field is of datatype date/time.

--
Roy-Vidar
Dec 10 '06 #2

P: n/a

I get a syntax error with;

DoCmd.OpenForm (petalplanning,acNormal, ,"plandate = #" &
Format$(Me!date8, "dd/mm/yyyy) & "#")

Thanks for the help

Dec 10 '06 #3

P: n/a
"keri" <ke*********@diageo.comwrote in message
<11**********************@j72g2000cwa.googlegroups .com>:
I get a syntax error with;

DoCmd.OpenForm (petalplanning,acNormal, ,"plandate = #" &
Format$(Me!date8, "dd/mm/yyyy) & "#")

Thanks for the help
What happens if you try to copy/paste of my suggestion, and use that
in stead?

--
Roy-Vidar
Dec 10 '06 #4

P: n/a

I get an error for the ) missing. If I add this at the end and try i
get the same syntax error.

I'm now trying through a macro, with a find record set to
[Forms]![frmCalendar]![Date8] but this isn't working either. I am
wondering if this is because the date8 text box isn't a set value.

Dec 10 '06 #5

P: n/a
"keri" <ke*********@diageo.comwrote in news:1165771090.695722.62310
@n67g2000cwd.googlegroups.com:
I am trying to;

Click on a textbox in a form called frmcalendar to open another form
petalplanning
(I can do that bit). However I want the form to open at a certain
record depending on the date in a textbox (called date8) on
frmcalendar. (Eg date8 in frmcalendar is to match the date in the
record called plandate in the petalplanning form)

I thought i would be able to do it this way but my criteria is wrong
DoCmd.OpenForm (petalplanning,acNormal, ,"plandate =
Forms!frmCalendar!date8")

Any suggestions how I can correct this? Thanks
Here is an example

DoCmd.OpenForm "Orders", , , "OrderDate = " & Format(Me.DateOne, "\#mm
\/dd\/yyyy\#")

that works.
--
Lyle Fairfield

http://www.ffdba.com/toyota/BurlingtonToyotaLease.htm

(just a sad story - read if bored)
Dec 10 '06 #6

P: n/a
"keri" <ke*********@diageo.comwrote in message
<11**********************@n67g2000cwd.googlegroups .com>:
I get an error for the ) missing. If I add this at the end and try i
get the same syntax error.

I'm now trying through a macro, with a find record set to
[Forms]![frmCalendar]![Date8] but this isn't working either. I am
wondering if this is because the date8 text box isn't a set value.
This method gives a syntax error if the arguements are surrounded
by parenthesis on my setup. Which is why I removed them in my
suggestion. The only parenthesis, should be the parenthesis around
the format function.

The method accepts the name of the form in quotes, which I put into
the suggestion.

Because the line became a bit long, I split it in two lines,
finishing the first line off with a line continuation mark
(underscore "_")

Here it is again, please try to copy paste the two lines into your
VBE and check the error message/what it highligts.

DoCmd.OpenForm "petalplanning", acNormal, ,"plandate = #" & _
Format$(Me!date8, "yyyy-mm-dd) & "#"

--
Roy-Vidar
Dec 10 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.