In Access97, I have a form [FilterFrm] with two fields, [DBDate] & [DBShift], that I am using to apply a filter on a 2nd form [RecordsFrm], which includes fields [wrkdate] and [shift]. This method of filtering records works fine for my purposes.
What I want to do is give the user the option to create a new record, if none is found by the filter, and pass the values from [FilterFrm] to that new record in [RecordsFrm]. I hope this makes sense.
Here is my code;
If Me.Filter > "" Then
If IsNull(Me![WrkDate]) And IsNull(Me![Shift]) Then
If msgbox("'The record was not found. Would you like to create it?" & Chr(13) & Chr(10) & _
"Press 'OK' to create the record." & Chr(13) & Chr(10) & _
"Press 'No' to browse records.", _
vbYesNo, "A Required field is Null") = vbYes Then
DoCmd.GoToRecord , , acNewRec
Me![WrkDate].Value = Forms!FilterFrm!DBDate
Me![Shift].Value = Forms!FilterFrm!DBShift
Else
Me.FilterOn = False
End If
End If
End If
I am getting an error(Error 2448) on the two lines;
Me![WrkDate].Value = Forms!FilterFrm!DBDate
Me![Shift].Value = Forms!FilterFrm!DBShift
While debugging I can see that the values from [FilterFrm] are being passed to the code, but everything I have tried has not fixed the problem.
Thanks in advance for any help.
What I want to do is give the user the option to create a new record, if none is found by the filter, and pass the values from [FilterFrm] to that new record in [RecordsFrm]. I hope this makes sense.
Here is my code;
If Me.Filter > "" Then
If IsNull(Me![WrkDate]) And IsNull(Me![Shift]) Then
If msgbox("'The record was not found. Would you like to create it?" & Chr(13) & Chr(10) & _
"Press 'OK' to create the record." & Chr(13) & Chr(10) & _
"Press 'No' to browse records.", _
vbYesNo, "A Required field is Null") = vbYes Then
DoCmd.GoToRecord , , acNewRec
Me![WrkDate].Value = Forms!FilterFrm!DBDate
Me![Shift].Value = Forms!FilterFrm!DBShift
Else
Me.FilterOn = False
End If
End If
End If
I am getting an error(Error 2448) on the two lines;
Me![WrkDate].Value = Forms!FilterFrm!DBDate
Me![Shift].Value = Forms!FilterFrm!DBShift
While debugging I can see that the values from [FilterFrm] are being passed to the code, but everything I have tried has not fixed the problem.
Thanks in advance for any help.