Open Second Form By Date

  • Thread starter Thread starter DavidW
  • Start date Start 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
 
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?
 
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?
 
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?
 
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 & "#"
 
Back
Top