office_guru
Registered User.
- Local time
- Yesterday, 21:56
- Joined
- Nov 17, 2004
- Messages
- 19
This is probably so simple but it's really hurting my head trying to figure it out. I have a form with a combo box that will pull up relevant data on the form. I've added a msgbox to the combo box with the intent that if the company doesn't have any records within the table for a message box to appear with the option to add a new record. If the record exist it should ideally come up and no pop-up. I'm guessing I'm missing a condition somewhere? I guess I'd assumed that the combo would have taken care of that, but not the case I'm getting the message box even if a record for that company does exist.
Private Sub ComboCompany_AfterUpdate()
Dim bytResponse As Byte
bytResponse = MsgBox("POCs do not exist for the Company you selected, would you like to create one?", vbYesNo + vbExclamation, "Not In List")
If bytResponse = vbYes Then
Response = acDataErrAdded
stDocName = "frm_pocs_input"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
datefield = NewData
ElseIf bytResponse = vbNo Then
Response = acDataErrContinue 'Show No message
End If
End Sub
As a final note in case it's relevant, the combo box is unbound off of my tbl_company and the remaining bound fields are off of my tbl_POC.
Thanks!
Private Sub ComboCompany_AfterUpdate()
Dim bytResponse As Byte
bytResponse = MsgBox("POCs do not exist for the Company you selected, would you like to create one?", vbYesNo + vbExclamation, "Not In List")
If bytResponse = vbYes Then
Response = acDataErrAdded
stDocName = "frm_pocs_input"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.GoToRecord , , acNewRec
datefield = NewData
ElseIf bytResponse = vbNo Then
Response = acDataErrContinue 'Show No message
End If
End Sub
As a final note in case it's relevant, the combo box is unbound off of my tbl_company and the remaining bound fields are off of my tbl_POC.
Thanks!