J
Jaybird
I'm trying to debug my Invoice form. It's query based with two subforms. I
keep getting this error when I use one of my combo boxes:
"The macro or function set to the BeforeUpdate or ValidationRule property
for this field is preventing Microsoft Office Access from saving data in the
field.
* If this is a macro, open the macro in the Macro window and remove the
action that forces a save (for example, GoToControl).
* If the macro includes a SetValue action, set the macro to the AfterUpdate
property of the control instead.
* If this is a function, redefine the function in the Module window."
I'm not sure if this is the problem or not, but it's the only instance where
I use the GoToControl command and I don't use SetValue or BeforeUpdate at
all. It's a piece of code I use to assign an invoice number to records in
the subform.
Private Sub Form_Current()
Dim Response As Variant
On Error Resume Next
If IsNull(Me.INVNUM) Then
Me.INVNUM = Format(DMax("Left([INVNUM],5)", "HDRPLAT") + 1, "00000") & "A"
Response = MsgBox("Is this what you want?", vbYesNoCancel)
If Response = vbNo Then
Me.Undo
DoCmd.GoToControl ("[cboSrchbyOrder]")
Exit Sub
End If
If Response = vbCancel Then
DoCmd.GoToControl ("[cboSrchbyOrder]")
Exit Sub
End If
End If
Me.CUSTNO = Me.Parent.[Cust No]
Me.SHIPDTMD = Me.Parent.[Shipped]
Me.SHIPDTY = Me.SHIPDTMD
Me.CUSTPO = Me.Parent.[Purchase Order]
If Forms!frmInvoice!sbfInvoice.Form!txtTtlChrgs < 0 Then
Me.ckCRMEM = True
Else
Me.ckCRMEM = False
End If
End Sub
It's supposed to assign an invoice number in a specific format if there
isn't one already assigned based on the response the user gives in the
message box. This isn't supposed to even fire up the GoToContol command
unless the response is either "no" or "cancel", I don't know why I'm getting
the error. In looking at the thing, I don't see that I have included
instructions on what to do if the response is "yes". Could this be the
problem?
keep getting this error when I use one of my combo boxes:
"The macro or function set to the BeforeUpdate or ValidationRule property
for this field is preventing Microsoft Office Access from saving data in the
field.
* If this is a macro, open the macro in the Macro window and remove the
action that forces a save (for example, GoToControl).
* If the macro includes a SetValue action, set the macro to the AfterUpdate
property of the control instead.
* If this is a function, redefine the function in the Module window."
I'm not sure if this is the problem or not, but it's the only instance where
I use the GoToControl command and I don't use SetValue or BeforeUpdate at
all. It's a piece of code I use to assign an invoice number to records in
the subform.
Private Sub Form_Current()
Dim Response As Variant
On Error Resume Next
If IsNull(Me.INVNUM) Then
Me.INVNUM = Format(DMax("Left([INVNUM],5)", "HDRPLAT") + 1, "00000") & "A"
Response = MsgBox("Is this what you want?", vbYesNoCancel)
If Response = vbNo Then
Me.Undo
DoCmd.GoToControl ("[cboSrchbyOrder]")
Exit Sub
End If
If Response = vbCancel Then
DoCmd.GoToControl ("[cboSrchbyOrder]")
Exit Sub
End If
End If
Me.CUSTNO = Me.Parent.[Cust No]
Me.SHIPDTMD = Me.Parent.[Shipped]
Me.SHIPDTY = Me.SHIPDTMD
Me.CUSTPO = Me.Parent.[Purchase Order]
If Forms!frmInvoice!sbfInvoice.Form!txtTtlChrgs < 0 Then
Me.ckCRMEM = True
Else
Me.ckCRMEM = False
End If
End Sub
It's supposed to assign an invoice number in a specific format if there
isn't one already assigned based on the response the user gives in the
message box. This isn't supposed to even fire up the GoToContol command
unless the response is either "no" or "cancel", I don't know why I'm getting
the error. In looking at the thing, I don't see that I have included
instructions on what to do if the response is "yes". Could this be the
problem?