G
Guest
I'm trying to simply increment a field in a table when i am in a form.
The table is tblhome and the form field is Home_addr_PK. The last record is
HA00052. When i create a new record, i would like HA0053 populated in the
Home_Addr_PK field. I am getting a "Type mismatch" error when i run this code
from a command button (new home address). Please help.
Private Sub New_Home_Address_Click()
On Error GoTo Err_New_Home_Address_Click
DoCmd.GoToRecord , , acNewRec
'Me!Home_Addr_PK = Format(DMax("[Home_Addr_PK])", "tblHome"), 0) + 1,
"0000")
Exit_New_Home_Address_Click:
Exit Sub
Err_New_Home_Address_Click:
MsgBox Err.Description
Resume Exit_New_Home_Address_Click
The table is tblhome and the form field is Home_addr_PK. The last record is
HA00052. When i create a new record, i would like HA0053 populated in the
Home_Addr_PK field. I am getting a "Type mismatch" error when i run this code
from a command button (new home address). Please help.
Private Sub New_Home_Address_Click()
On Error GoTo Err_New_Home_Address_Click
DoCmd.GoToRecord , , acNewRec
'Me!Home_Addr_PK = Format(DMax("[Home_Addr_PK])", "tblHome"), 0) + 1,
"0000")
Exit_New_Home_Address_Click:
Exit Sub
Err_New_Home_Address_Click:
MsgBox Err.Description
Resume Exit_New_Home_Address_Click