Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a form to edit or add 1

Status
Not open for further replies.

DLynnTX

IS-IT--Management
Dec 9, 2004
67
US
I have a main form that has several sub-forms. However, I want to use a pop-up form as well if the client has a mailing address (i.e. don't want the info visible unless entering data). I created a button on the main form that opens the MailAddy form. And I changed the MailAddy form to only show currentrecord so that they can't enter more than one mailing address per client. Here's my problem. Since the mailing address info is in a separate table, I need the ClientID to be filled in from the Main table if it doesn't exist in the MailAddy table. If it does exist, I need the form to open to the existing record. The editing works (I tested it by adding a record directly to the MailAddy table using the correct ClientID). However, adding a new record does not work. It gives a ClientID of 0000.
Thank you in advance for your help!
 
How are ya DLynnTX . . .

In the [blue]On Current[/blue] event of the [blue]MailAddy[/blue] form, try this:
Code:
[blue]   If CurrentProject.AllForms("[purple][b]MainFormName[/b][/purple]").IsLoaded = True And _
      Me.NewRecord = True Then
      Me!ClientID = Forms![[purple][b]MainFormName[/b][/purple]]!ClientID
   End If[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
That worked PERFECTLY!! Thank you so much!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top