Hi, Hope someone can help me. I am trying to update a 2nd table 'WhatsNext" after entering a date in a field "ReadDate" (mmm-yy format), in table "Books".
There is a slight variation as I must reformat the date for another filed on the form "MyDate". I can see the date go into in "MyDate" upon exiting the field "ReadDate" but when I try to Update the table/field "WhatsNext.MyDate" from the field "Me.MyDate" on the form, I get a pop up box asking me to enter the parameter value for 'MyDate" Here is my code
Sorry for the long explanation. Thanks.
There is a slight variation as I must reformat the date for another filed on the form "MyDate". I can see the date go into in "MyDate" upon exiting the field "ReadDate" but when I try to Update the table/field "WhatsNext.MyDate" from the field "Me.MyDate" on the form, I get a pop up box asking me to enter the parameter value for 'MyDate" Here is my code
PHP:
Private Sub ReadDate_Exit(Cancel As Integer)
' ***THESE NEXT TWO ROUTINES ARE STRICTLY FOR USE IN THE Read by Month Report******
If IsNull(Me.ReadDate) Then 'If ReadDate is Null,
Me.RightDate = "" 'Set RightDate Null or opening form will error out.
Else 'compute the value if ReadDate and put here in date format
Me.RightDate = DateValue("1" & "-" & Left([ReadDate], 3) & "-" & "20" & Right([ReadDate], 2))
End If
If IsNull(Me.RightDate.Value) Then ' If RightDate is empty
Me.Mydate = "" ' Set MyDate to Null
Else ' Set MyDate Field to the value of RightDate
Me.Mydate = Me.RightDate.Value ' This was the only way I could get a date for
End If
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE WhatsNext " & _
"SET WhatsNext.Mydate = Me.Mydate " & _
"WHERE WhatsNext.AuthorID = Books.AuthorId"
DoCmd.SetWarnings True
End Sub
Sorry for the long explanation. Thanks.