Edit Existing Records When Form Opens To A New Record

Edit Existing Records When Form Opens To A New Record

Post by UEhpc2F » Thu, 27 Jul 2006 01:40:02


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
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 Sub

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!

1. Form (new record) based on open form record

2. Looking for pushbuttoncommand on form that copies existing record to a new record

Hash: SHA1

Let Access built-in features do the work for you:

1. Hit Shift-Enter to save a Record without leaving the current record.
Make sure the cursor is not in a Text Box that uses Shift-Enter to move
to the next line in the Text Box.
2. Move to the next/previous record to save the current record.
3. Close the form to save the record.

MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

Version: PGP for Personal Privacy 5.0
Charset: noconv


3. Form to Check for existing record, if none found create new record.

4. open a record if it exists; otherwise add new record

5. Looking for pushbuttoncommand on form that copies existing record to a new record

6. Open a form with a blank record and view existing records

7. Form drops edited record-inserts new record instead

8. Update existing record else insert record if no record exists

9. Form to Edit Records - Selecting Records To Edit

10. How to know who is locking/editing the record in the record edit form?

11. Open form and if no matching records create a new record

12. Save subform record, open form, then go to new record

13. Double Click on a Record in a Subform to Open that record in a new form.

14. Open new record in form for editing after addind using NotInList

15. Open a new form based on current form and append new record query