Hello,
I hope someone can help.
I have a sales order system.
My main data entry form has the following setup:
frmNewSale, sfrmSalesHeader, sfrmSalesLine.
The onload event sets sfrmSalesHeader to the next invoice number.
In certain circumstances I wish to recall an existing sales invoice and amend it. The record is identified in a separate form LQSelect
In the onload event of sfrmSalesHeader I have put the following:
Private Sub Form_Load()
'if form LQ select is open go to selected record
If Application.SysCmd(acSysCmdGetObjectState, acForm, "frmLQSelect") = acObjStateOpen Then
Dim LQRef As Long
LQRef = Forms!frmLQselect!txtSalesInvID
Me!txtSalesInvID.SetFocus
DoCmd.GoToRecord , , acGoTo, LQRef
Else
DoCmd.GoToRecord , , acNewRec
Me!txtSalesInvID = DMax("[SalesInvID]", "tblSalesHeader") + 1
End If
End Sub
The line highlighted red is where the debugger highlights the issue.
In its table SalesInvID is a long integer.
Any ideas? I have been searching for 2 days now with no joy.
Many thanks
I hope someone can help.
I have a sales order system.
My main data entry form has the following setup:
frmNewSale, sfrmSalesHeader, sfrmSalesLine.
The onload event sets sfrmSalesHeader to the next invoice number.
In certain circumstances I wish to recall an existing sales invoice and amend it. The record is identified in a separate form LQSelect
In the onload event of sfrmSalesHeader I have put the following:
Private Sub Form_Load()
'if form LQ select is open go to selected record
If Application.SysCmd(acSysCmdGetObjectState, acForm, "frmLQSelect") = acObjStateOpen Then
Dim LQRef As Long
LQRef = Forms!frmLQselect!txtSalesInvID
Me!txtSalesInvID.SetFocus
DoCmd.GoToRecord , , acGoTo, LQRef
Else
DoCmd.GoToRecord , , acNewRec
Me!txtSalesInvID = DMax("[SalesInvID]", "tblSalesHeader") + 1
End If
End Sub
The line highlighted red is where the debugger highlights the issue.
In its table SalesInvID is a long integer.
Any ideas? I have been searching for 2 days now with no joy.
Many thanks
