Why doesn't this work in Access 2007?

  • Thread starter Thread starter Mary Fran
  • Start date Start date
M

Mary Fran

(Posted to Programming but no response, so trying here)
I'm still trying to determine why a 2003 application runs fine when opened in
2007 EXCEPT for this code- the field "Endtime" is not being updated but does
in 2003 - can someone help, please?!

DoCmd.Echo False, ""
DoCmd.SelectObject acForm, "frmStudentTimeCard"
DoCmd.ShowAllRecords
DoCmd.ApplyFilter "", "[ID]=[Forms]![frmStudyHallSignIn]![StudentsIn]
And IsNull([endtime])"
If Hour(Time()) < 1 Then
Forms!frmstudenttimecard!Endtime = #11:59:00 PM#
Else
Forms!frmstudenttimecard!Endtime = Time()
End If
DoCmd.ShowAllRecords
Forms!frmstudenttimecard.Visible = False
DoCmd.SelectObject acForm, "frmStudyHallSignIn"
DoCmd.Echo True, ""
DoCmd.Requery "StudentsIn"
Me!Student = Null
 
I'll take a wag at it.

If "Forms!frmstudenttimecard!Endtime" is a textBox and is bound to a Column
in "frmstudenttimecard" RecordSource whose name is "Endtime", then try
changing the name of the textbox to something else (like txtEndtime
perhaps).

Rdub
 
Thanks for the "wag", Rdub, but I just learned another clue to the mystery
(remember, it works fine in A2003). What Access is now doing is instead of
updating the Endtime field in the correct record, it is adding a blank record
and updating that one - meaning, the applyfilter didn't work like it does in
A2003. Any further ideas?!


Ron Weiner said:
I'll take a wag at it.

If "Forms!frmstudenttimecard!Endtime" is a textBox and is bound to a Column
in "frmstudenttimecard" RecordSource whose name is "Endtime", then try
changing the name of the textbox to something else (like txtEndtime
perhaps).

Rdub
Mary Fran said:
(Posted to Programming but no response, so trying here)
I'm still trying to determine why a 2003 application runs fine when opened
in
2007 EXCEPT for this code- the field "Endtime" is not being updated but
does
in 2003 - can someone help, please?!

DoCmd.Echo False, ""
DoCmd.SelectObject acForm, "frmStudentTimeCard"
DoCmd.ShowAllRecords
DoCmd.ApplyFilter "", "[ID]=[Forms]![frmStudyHallSignIn]![StudentsIn]
And IsNull([endtime])"
If Hour(Time()) < 1 Then
Forms!frmstudenttimecard!Endtime = #11:59:00 PM#
Else
Forms!frmstudenttimecard!Endtime = Time()
End If
DoCmd.ShowAllRecords
Forms!frmstudenttimecard.Visible = False
DoCmd.SelectObject acForm, "frmStudyHallSignIn"
DoCmd.Echo True, ""
DoCmd.Requery "StudentsIn"
Me!Student = Null
 
I have since read of possible problems with the ApplyFilter method of the
docmd object in A2007 so I changed my code to the following:
Forms.frmstudenttimecard.FilterOn = False
Forms.frmstudenttimecard.Filter =
"[ID]=[Forms]![frmStudyHallSignIn]![StudentsIn] And IsNull([Endtime])"
Forms.frmstudenttimecard.FilterOn = True

In A2003 it updates everything fine and in A2007 it still doesn't filter the
record correctly. Can anyone help?!


Mary Fran said:
Thanks for the "wag", Rdub, but I just learned another clue to the mystery
(remember, it works fine in A2003). What Access is now doing is instead of
updating the Endtime field in the correct record, it is adding a blank record
and updating that one - meaning, the applyfilter didn't work like it does in
A2003. Any further ideas?!


Ron Weiner said:
I'll take a wag at it.

If "Forms!frmstudenttimecard!Endtime" is a textBox and is bound to a Column
in "frmstudenttimecard" RecordSource whose name is "Endtime", then try
changing the name of the textbox to something else (like txtEndtime
perhaps).

Rdub
Mary Fran said:
(Posted to Programming but no response, so trying here)
I'm still trying to determine why a 2003 application runs fine when opened
in
2007 EXCEPT for this code- the field "Endtime" is not being updated but
does
in 2003 - can someone help, please?!

DoCmd.Echo False, ""
DoCmd.SelectObject acForm, "frmStudentTimeCard"
DoCmd.ShowAllRecords
DoCmd.ApplyFilter "", "[ID]=[Forms]![frmStudyHallSignIn]![StudentsIn]
And IsNull([endtime])"
If Hour(Time()) < 1 Then
Forms!frmstudenttimecard!Endtime = #11:59:00 PM#
Else
Forms!frmstudenttimecard!Endtime = Time()
End If
DoCmd.ShowAllRecords
Forms!frmstudenttimecard.Visible = False
DoCmd.SelectObject acForm, "frmStudyHallSignIn"
DoCmd.Echo True, ""
DoCmd.Requery "StudentsIn"
Me!Student = Null
 
Back
Top