Edit Existing Records When Form Opens To A New Record

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top