Open Second Form By Date

D

DavidW

I am trying to open a second form from the first form using date, I have
tried
Me.Refresh
DoCmd.OpenForm "outsidepurchase", , , "[date] = " & Me!date
and its not working.
Both Forms "outsidepurchase" and "setdate" have a textbox linked to the same
tablefield of "date"
Any Ideals?
Thanks
David
 
J

John Vinson

I am trying to open a second form from the first form using date, I have
tried
Me.Refresh
DoCmd.OpenForm "outsidepurchase", , , "[date] = " & Me!date
and its not working.
Both Forms "outsidepurchase" and "setdate" have a textbox linked to the same
tablefield of "date"
Any Ideals?
Thanks
David

Date is a reserved word, for Access' builtin Date() function which
returns today's date. I'd suggest changing the fieldname!

That said... what's "not working"? do you get an error, a blank form,
a form opening to the wrong record, or what?
 
D

DavidW

Opening the wrong record
John Vinson said:
I am trying to open a second form from the first form using date, I have
tried
Me.Refresh
DoCmd.OpenForm "outsidepurchase", , , "[date] = " & Me!date
and its not working.
Both Forms "outsidepurchase" and "setdate" have a textbox linked to the same
tablefield of "date"
Any Ideals?
Thanks
David

Date is a reserved word, for Access' builtin Date() function which
returns today's date. I'd suggest changing the fieldname!

That said... what's "not working"? do you get an error, a blank form,
a form opening to the wrong record, or what?
 
D

DavidW

I switched the name of the text box to date1 and I am still getting the same
result.
What I get is either an error of openform canceled or a form that is not on
the record>
Me.Dirty = False
Me.Refresh
DoCmd.OpenForm "pumpreading", , , "[date1] = '" & Me!date1 & "'"
Any Ideals?
 
R

Rick Brandt

DavidW said:
I switched the name of the text box to date1 and I am still getting the same
result.
What I get is either an error of openform canceled or a form that is not on
the record>
Me.Dirty = False
Me.Refresh
DoCmd.OpenForm "pumpreading", , , "[date1] = '" & Me!date1 & "'"
Any Ideals?

The syntax above is correct for a text field, but not for a date field.

DoCmd.OpenForm "pumpreading", , , "[date1] = #" & Me!date1 & "#"
 

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