I got a lot of help from PHV on this originally thread702-1374042. But I am stuck now. I use the following to transfer data from one record in a subform to another. The subform is "singleform". And I use a command button if I want the same data transferred to the new record as follows:
OnClick:
Me.[txtServiceAddress].DefaultValue = "'" & Me.[txtServiceAddress].Value & "'"
Me.[txtServiceCity].DefaultValue = "'" & Me.[txtServiceCity].Value & "'"
DoCmd.GoToRecord , , acNewRec
Me.txtServiceID.SetFocus
End Sub
It transfers the data fine, however, if one of these fields is null I get the following error when I try to save the record:
Field 'tbl_Locations.ServiceCity' cannot be a zero-length string.
They are not mandatory fields and some fields are often left blank.
How can I handle the NULL in this case. I don't understand why transferring a NULL field suddenly makes it want to force data in that field. Thanks for any help.
OnClick:
Me.[txtServiceAddress].DefaultValue = "'" & Me.[txtServiceAddress].Value & "'"
Me.[txtServiceCity].DefaultValue = "'" & Me.[txtServiceCity].Value & "'"
DoCmd.GoToRecord , , acNewRec
Me.txtServiceID.SetFocus
End Sub
It transfers the data fine, however, if one of these fields is null I get the following error when I try to save the record:
Field 'tbl_Locations.ServiceCity' cannot be a zero-length string.
They are not mandatory fields and some fields are often left blank.
How can I handle the NULL in this case. I don't understand why transferring a NULL field suddenly makes it want to force data in that field. Thanks for any help.