Hi All,
Stumped on the following VB script -
I have a form (frmCircuitsMainEntry) with a combo box that access a field called "CircuitVendor". When the user enters a vendor name that isn't associated with a record, the following message is displayed - "user text" is not in the database. Do you want to add "user text" to the list?" If yes, then a seperate form (frmCompanyEntry) is opened in new record mode.
All this works, my problem is that I want the user entered data (the new vendor) the be auto entered into a field (CoName) in the new record on the opened form (frmCompanyEntry)....
Additionally, I tried suppressing the access message "blah blah not in list" to no avail with set warning to false. I think I need to suppress the message - correct? Help with the script?
Thanks in advance.
-CK
Here is the VB code so far (attached to the NotInList Event):
Private Sub CircuitVendor_NotInList(NewData As String, Response As Integer)
Dim bytResponse As Byte
bytResponse = MsgBox(CircuitVendor.Text & " is not in the database. Do you want to add " & CircuitVendor.Text & " to the list?", vbYesNo)
DoCmd.SetWarnings False
If bytResponse = vbYes Then
Me!CircuitVendor.Undo
DoCmd.OpenForm "frmCompanyEntry", acNormal, , , acFormEdit, acNormalWindow
DoCmd.GoToRecord , , acNewRec
Else
Response = acDataErrContinue
Me!LocBCompany.Undo
End If
End Sub
Stumped on the following VB script -
I have a form (frmCircuitsMainEntry) with a combo box that access a field called "CircuitVendor". When the user enters a vendor name that isn't associated with a record, the following message is displayed - "user text" is not in the database. Do you want to add "user text" to the list?" If yes, then a seperate form (frmCompanyEntry) is opened in new record mode.
All this works, my problem is that I want the user entered data (the new vendor) the be auto entered into a field (CoName) in the new record on the opened form (frmCompanyEntry)....
Additionally, I tried suppressing the access message "blah blah not in list" to no avail with set warning to false. I think I need to suppress the message - correct? Help with the script?
Thanks in advance.
-CK
Here is the VB code so far (attached to the NotInList Event):
Private Sub CircuitVendor_NotInList(NewData As String, Response As Integer)
Dim bytResponse As Byte
bytResponse = MsgBox(CircuitVendor.Text & " is not in the database. Do you want to add " & CircuitVendor.Text & " to the list?", vbYesNo)
DoCmd.SetWarnings False
If bytResponse = vbYes Then
Me!CircuitVendor.Undo
DoCmd.OpenForm "frmCompanyEntry", acNormal, , , acFormEdit, acNormalWindow
DoCmd.GoToRecord , , acNewRec
Else
Response = acDataErrContinue
Me!LocBCompany.Undo
End If
End Sub