473,326 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Openform criteria

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
6 2070
"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

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
"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

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
"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nairb | last post by:
In " vb help" the example for OpenForm Method works fine... DoCmd.OpenForm "Employees", , ,"LastName = 'King'" However if I try to apply the example to my field which is a "yes or no" it does...
8
by: John Welch | last post by:
I have a command button with the following code: DoCmd.OpenForm "frmSearchAssignments", , , "SearchAssignmentID = 1" (SearchAssignmentID is the PK, auto number) When it runs, the form opens but...
4
by: Beejer | last post by:
Greeting, I'm trying to launch an OpenForm function with a double criteria. I can't seem to make them work together, the two criteria work seperatly so I assume my code to synchronise both...
2
by: mark mestrom | last post by:
hi, i have this problem with OpenForm and the stLinkCriteria. I have the following code: Private Sub Knop22_Click() On Error GoTo Err_Knop22_Click Dim stDocName As String Dim...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.