P
PHisaw
Hi,
I have a form with the following NotInList code that opens a Contact Form to
a new record. If I have a new customer entry this works great. The problem
I've ran into is how to open the form when I need to edit existing contact
info. The
contact may be in the table, but have changed phone numbers or added an email
address. When I click on the command button to open the form, I get an error
message - "You can't go to specified record" I know it is because of the
OnLoad code, but is there anything I can do to get around this. In other
words, I want it to work both ways.
First Form
Private Sub ContactNameCombo_NotInList(NewData As String, Response As
Integer)
On Error GoTo Err_ContactNameCombo_NotInList
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "fContactList"
DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Exit_ContactNameCombo_NotInList:
Exit Sub
Err_ContactNameCombo_NotInList:
MsgBox Err.Description
Resume Exit_ContactNameCombo_NotInList
End Sub
Contact Form "fContactList"
Private Sub Form_Load()
Me.ContactName = Me.OpenArgs
End Sub
Any help is appreciated!! Thanks in advance!
Pam
I have a form with the following NotInList code that opens a Contact Form to
a new record. If I have a new customer entry this works great. The problem
I've ran into is how to open the form when I need to edit existing contact
info. The
contact may be in the table, but have changed phone numbers or added an email
address. When I click on the command button to open the form, I get an error
message - "You can't go to specified record" I know it is because of the
OnLoad code, but is there anything I can do to get around this. In other
words, I want it to work both ways.
First Form
Private Sub ContactNameCombo_NotInList(NewData As String, Response As
Integer)
On Error GoTo Err_ContactNameCombo_NotInList
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "fContactList"
DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Exit_ContactNameCombo_NotInList:
Exit Sub
Err_ContactNameCombo_NotInList:
MsgBox Err.Description
Resume Exit_ContactNameCombo_NotInList
End Sub
Contact Form "fContactList"
Private Sub Form_Load()
Me.ContactName = Me.OpenArgs
End Sub
Any help is appreciated!! Thanks in advance!
Pam