open form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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

Ofer Cohen said:
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


Chey said:
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
 
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


Chey said:
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.

Ofer Cohen said:
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


Chey said:
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
 
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

Ofer Cohen said:
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


Chey said:
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.

Ofer Cohen said:
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
 
Try this code:

Dim MyWhereCondition As String

MyWhereCondition = "[Grant Turned In Date] = #" & Me.[Grant Turned In Date]
& "#"

DoCmd.OpenForm "Mercedes Cert", , , MyWhereCondition


Chey said:
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

Ofer Cohen said:
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


Chey said:
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
 
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!)


schasteen said:
Try this code:

Dim MyWhereCondition As String

MyWhereCondition = "[Grant Turned In Date] = #" & Me.[Grant Turned In Date]
& "#"

DoCmd.OpenForm "Mercedes Cert", , , MyWhereCondition


Chey said:
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

Ofer Cohen said:
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
 
okay I am glad you found it however it still is not working. It opens the
form okay but does not filter only the date I am choosing. It seems as if it
is only doing one of the things it is told. In my query however, I have
criteria under field one I have is not null under another I have hold-False,
and another check box false.
Do you thing any of this has to do with it not working. I also have a
critera on the Grant Turned In Date I Have
<Date()+1 Should I take that out?

schasteen said:
Try this code:

Dim MyWhereCondition As String

MyWhereCondition = "[Grant Turned In Date] = #" & Me.[Grant Turned In Date]
& "#"

DoCmd.OpenForm "Mercedes Cert", , , MyWhereCondition


Chey said:
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

Ofer Cohen said:
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
 
Change the code to be

DoCmd.OpenForm "Mercedes Cert"

and replace the criteria for the date in your query with

Forms![Choose_Date]![Grant Turned In Date]



Chey said:
okay I am glad you found it however it still is not working. It opens the
form okay but does not filter only the date I am choosing. It seems as if it
is only doing one of the things it is told. In my query however, I have
criteria under field one I have is not null under another I have hold-False,
and another check box false.
Do you thing any of this has to do with it not working. I also have a
critera on the Grant Turned In Date I Have
<Date()+1 Should I take that out?

schasteen said:
Try this code:

Dim MyWhereCondition As String

MyWhereCondition = "[Grant Turned In Date] = #" & Me.[Grant Turned In Date]
& "#"

DoCmd.OpenForm "Mercedes Cert", , , MyWhereCondition


Chey said:
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
 
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?

Douglas J Steele said:
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!)


schasteen said:
Try this code:

Dim MyWhereCondition As String

MyWhereCondition = "[Grant Turned In Date] = #" & Me.[Grant Turned In Date]
& "#"

DoCmd.OpenForm "Mercedes Cert", , , MyWhereCondition


Chey said:
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
 
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

Chey said:
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?

Douglas J Steele said:
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!)


schasteen said:
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
 
I got it to work This is the difference
Format(Me.[Grant Turned In Date], "\#mm\/dd\/yyyy\#")
this is what I did Format(Me.[Grant Turned In Date], "mm\/dd\/yyyy")
i took out \# on both sides. Crazy!!!!!

schasteen said:
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

Chey said:
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?

Douglas J Steele said:
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
 
I guess I didn't get it to work. Everything is still opening.
What am I forgetting?

Chey said:
I got it to work This is the difference
Format(Me.[Grant Turned In Date], "\#mm\/dd\/yyyy\#")
this is what I did Format(Me.[Grant Turned In Date], "mm\/dd\/yyyy")
i took out \# on both sides. Crazy!!!!!

schasteen said:
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

Chey said:
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
 
That should work.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Chey said:
I guess I didn't get it to work. Everything is still opening.
What am I forgetting?

Chey said:
I got it to work This is the difference
Format(Me.[Grant Turned In Date], "\#mm\/dd\/yyyy\#")
this is what I did Format(Me.[Grant Turned In Date], "mm\/dd\/yyyy")
i took out \# on both sides. Crazy!!!!!

schasteen said:
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
 

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

Back
Top