vihaan
asked on
ms access cannot find the record "|"referred to in your expression
Hi I do not why am i getting this message " Ms access cnnot find the field " | " referred to in your expression , when i click the save button to save the record. And this happens only when i am about to save the first record, but this does not show up when i add 2 nd record or 3 rd record . it happens only with 1st record.
ASKER
Private Sub button_save_rec_Click()
On Error GoTo Err_button_save_rec_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_button_save_rec_Click :
Exit Sub
Err_button_save_rec_Click:
MsgBox Err.Description
Resume Exit_button_save_rec_Click
End Sub
On Error GoTo Err_button_save_rec_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_button_save_rec_Click
Exit Sub
Err_button_save_rec_Click:
MsgBox Err.Description
Resume Exit_button_save_rec_Click
End Sub
It sounds like your csv file wasn't imported correctly to its destination table in Access.
Lets try this first. Since the DoMenuItem commands were depricated more that 10 years ago by Microsoft ... use this to Save a record:
Private Sub button_save_rec_Click()
Me.Dirty = False ' Save the record
End Sub
Also, do you have *any* code in the Form Before Update event ?
mx
Private Sub button_save_rec_Click()
Me.Dirty = False ' Save the record
End Sub
Also, do you have *any* code in the Form Before Update event ?
mx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Captures most recent date
Me.frm_qna_contacts_update _date = Date
'Captures shortname of windows operating system
Me.frm_qna_contacts_update _user = VBA.Environ("USERNAME")
End Sub
'Captures most recent date
Me.frm_qna_contacts_update
'Captures shortname of windows operating system
Me.frm_qna_contacts_update
End Sub
Question:
Is
frm_qna_contacts_update_da te
the Name of a Field in table, a Control or a Form?
Same for
Me.frm_qna_contacts_update _user
You error is most likely occurring on one of these two lines in the BU event.
mx
Is
frm_qna_contacts_update_da
the Name of a Field in table, a Control or a Form?
Same for
Me.frm_qna_contacts_update
You error is most likely occurring on one of these two lines in the BU event.
mx
The modern syntax for saving a record is
DoCmd.RunCommand acCmdSaveRecord
In my experience, getting that error message referring to a field called "|" often indicates table corruption. If you open the table and see Chinese characters in some fields, that confirms the diagnosis <g>.
DoCmd.RunCommand acCmdSaveRecord
In my experience, getting that error message referring to a field called "|" often indicates table corruption. If you open the table and see Chinese characters in some fields, that confirms the diagnosis <g>.
vihaan:
Check for any possible typos in those two names.
Because you do have code in the BU event, when you attempt to Save, errors will occur in the BU event if "something isn't right"
mx
Check for any possible typos in those two names.
Because you do have code in the BU event, when you attempt to Save, errors will occur in the BU event if "something isn't right"
mx
ASKER
Hi, the field names are form field names in BU event .
Did you check for typos?
Put a breakpoint on the beginning of the BU event ... then single step through (using F8) until the error occurs and see exactly which line it occurs on.
Another syntax you can try:
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Captures most recent date
Me("frm_qna_contacts_updat e_date") = Date
'Captures shortname of windows operating system
Me("frm_qna_contacts_updat e_user") = VBA.Environ("USERNAME")
End Sub
Put a breakpoint on the beginning of the BU event ... then single step through (using F8) until the error occurs and see exactly which line it occurs on.
Another syntax you can try:
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Captures most recent date
Me("frm_qna_contacts_updat
'Captures shortname of windows operating system
Me("frm_qna_contacts_updat
End Sub
ASKER
good
mx