Hello,
I am getting the following error message when closing a form: Run Time Error 3315 – Field XXX cannot contain zero length string.
My db is update every month with data that I import from a text file.
Data is imported in a table (table1) and displayed in form1 using a query as records source as to to open the form users select certain criteria.
This data cannot be changed or modified.
This form has also some fields that are duplicated in another table that I call History, which saves data as table1 every month is updates with new records and i need to save the updated information. The old records in Table1 are deleted before I import the new ones.
To save data into table History, I run the following code on the close event:
'Append new data from controls in Table1 to table History.
Dim chgreqrec As Recordset
Set chgreqrec = CurrentDb.OpenRecordset("History")
chgreqrec.AddNew
chgreqrec![NewPhone] = NewPhone
chgreqrec!NewAddress = NewAddress
chgreqrec.Update
Me.NewPhone.Value = Null
Me.NewAddress.Value = Null
DoCmd.Close
The form should be able to close with or without updates to the various fields, meaning even if they are left blank.
Thank you for any help with this matter.
I am getting the following error message when closing a form: Run Time Error 3315 – Field XXX cannot contain zero length string.
My db is update every month with data that I import from a text file.
Data is imported in a table (table1) and displayed in form1 using a query as records source as to to open the form users select certain criteria.
This data cannot be changed or modified.
This form has also some fields that are duplicated in another table that I call History, which saves data as table1 every month is updates with new records and i need to save the updated information. The old records in Table1 are deleted before I import the new ones.
To save data into table History, I run the following code on the close event:
'Append new data from controls in Table1 to table History.
Dim chgreqrec As Recordset
Set chgreqrec = CurrentDb.OpenRecordset("History")
chgreqrec.AddNew
chgreqrec![NewPhone] = NewPhone
chgreqrec!NewAddress = NewAddress
chgreqrec.Update
Me.NewPhone.Value = Null
Me.NewAddress.Value = Null
DoCmd.Close
The form should be able to close with or without updates to the various fields, meaning even if they are left blank.
Thank you for any help with this matter.