Okay, I'm not sure I've done this right now...
this is the code i have in the on load event for the new customer form "frmDiaBox_NewCustomer"
Code:
Private Sub Form_Load()
If Application.CurrentProject.AllForms(frmJobRecord).IsLoaded = True Then
CustomerName = OpenArgs
Else
DoCmd.GoToRecord , , acNewRec
End If
End Sub
Its just opening a new record though (the "frmJobRecord" was open), not bringing over the text entered on the combo-box "cboCustomer" on the Job Record form "frmJobRecord" which is where the below code is
Code:
Private Sub cboCustomer_NotInList(NewData As String, Response As Integer)
On Error GoTo cboCustomer_NotInList_Error
Dim AddCustomer
AddCustomer = MsgBox("Would You Like To Add " & _
StrConv(NewData, vbProperCase) & " as a new customer? ", vbYesNo)
If AddCustomer = vbNo Then
cboCustomer.Undo
Response = acDataErrContinue
Else
Response = acDataErrContinue
Response = acDataErrAdded
DoCmd.OpenForm "frmDiabox_NewCustomer", , , , , acDialog, NewData
cboCustomer.Undo
cboCustomer.Requery
cboCustomer = DLookup("[CustomerName]", "[tblCustomers]", "[CustomerName]='" & NewData & "'")
' tell access not to show the error message if the dataform is cancelled
Response = acDataErrContinue
End If
On Error GoTo 0
Exit Sub
cboCustomer_NotInList_Error:
MsgBox "Error Has Been Found " & Err.Number & " (" & Err.Description & ") In Procedure (cboCustomer_NotInList) Of (frmDiabox_NewCustomer)"
End Sub