For is example try the afterupdate event.
MyWhereCondition = "[Grant Turned In Date] = " & _
Format(Me.[Grant Turned In Date], "\#mm\/dd\/yyyy\#")
DoCmd.OpenForm "Mercedes Cert", , , MyWhereCondition
:
This is exactly what I have
Private Sub Grant_Turned_In_Date_Change()
Dim MyWhereCondition As String
MyWhereCondition = "[Grant Turned In Date] = " & _
Format(Me.[Grant Turned In Date], "\#mm\/dd\/yyyy\#")
DoCmd.OpenForm "Mercedes Cert", , , "[Grant Turned In Date] = " & _
Format(Me.[Grant Turned In Date], "\#mm\/dd\/yyyy\#")
End Sub
I have it under on change should I put this code somewhere else?
:
Just in case the user doesn't have mm/dd/yyyy set as his/her Short
Date
format (through Regional Settings), it's safer to use:
MyWhereCondition = "[Grant Turned In Date] = " & _
Format(Me.[Grant Turned In Date], "\#mm\/dd\/yyyy\#")
Access will always try to use mm/dd/yyyy format first, even if the
default
date format has been changed to dd/mm/yyyy. Only when it sees that
the first
number is 13 or greater will it recognize dd/mm/yyyy correctly.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
Try this code:
Dim MyWhereCondition As String
MyWhereCondition = "[Grant Turned In Date] = #" & Me.[Grant
Turned In
Date]
& "#"
DoCmd.OpenForm "Mercedes Cert", , , MyWhereCondition
:
Dim MyWhereCondition As String
[Cert]![Grant Turned In Date] = Forms![Choose_Date]![Grant
Turned In
Date] =
"[Grant Turned In Date] = #" & Me.[Grant Turned In Date] & "#"
DoCmd.OpenForm "Mercedes Cert", , , [Cert]![Grant Turned In
Date] =
Forms![Choose_Date]![Grant Turned In Date]
Now it is telling me it can not find the refrence. By query in
the form
I
am trying to open is called cert. The form name is Mercedes
Cert. and
I
actually copied the where condition. The form with the combo
box is
Choose_Date and the field that I want is Grant Turned In Date
:
Try
Private Sub Grant_Turned_In_Date_Enter()
Dim MyWhereCondition As String
MyWhereCondition = "[Grant Turned in Date] = #" & Me.[Grant
Turned In
Date]
& "#"
DoCmd.OpenForm "Mercedes Cert", , , MyWhereCondition
End Sub
--
HTH, Good Luck
BS"D
:
Private Sub Grant_Turned_In_Date_Enter()
Dim [Grant Turned In Date] = [Forms]![Choose_Date]![Grant
Turned In
Date]As
String
[Grant Turned In Date] = [Forms]![Choose_Date]![Grant
Turned In
Date] =
"[Grant Turned in Date] = #" & Me.[Grant Turned In Date] &
"#"
DoCmd.OpenForm "Mercedes Cert", , , [Grant Turned In Date]
=
[Forms]![Choose_Date]![Grant Turned In Date]
this is what I have however the first part Dim [Grant
Turned In
Date] =
[Forms]![Choose_Date]![Grant Turned In Date]As String is
red. I am
not sure
what I did wrong here. You had for me put the where
condition. Was
I really
suppose to put it there or just have it say where
condition? Thanks
for your
help.
:
Have you tried this
Dim MyWhereCondition As String
MyWhereCondition = "[DateFieldName] = #" &
Me.[ComboName] & "#"
docmd.OpenForm "FormName",,,MyWhereCondition
If you filter on date you need to add # before and after
the date
--
HTH, Good Luck
BS"D
:
I have a form with a combo box. I want to choose a
date in the
list and when
it opens the form it filters only that date. Do I put
that
under the filter
part and if so how do I word it. It not do I do a
where
condition. I have
tried that and it does not seem work properly.
Can someone please explain to me how I can get this to
work?
Thanks
Chey