How do I copy a value from one form to another?

G

Guest

My situation...

I have a form that is created from a query of two tables. Within this form
there is a contactID (foreign key to the contact table), giftID (primary
key), batchID (foreign key to the batch table), and now a tributeID (foreign
key to the tribute table). After entering all the gift information including
associating all the IDs (except tribute), I want to be able to associate a
tribute. I have set the field to be a lookup value. If the value is not
there I created a pop-up box that asks, 'Add a new tribute?' If the answer
is yes, the tribute form opens. I then add a new tribute. My question is,
how can I copy the value of the new tributeID and place it in the tributeID
field on the Gift form? I have tried global variables,etc. with no luck. What
am I missing?

See the code that I have tried below: (This will work within the same form.
It will not work using multiple forms.) Note: I have tried writing -
Form![GiftForm]![txtTributeID.value] = stTribute

Option Compare Database
Public stTribute As String
Private Sub Command12_Click()
DoCmd.Save
stTribute = Me.Tribute_Name
txtTest.Value = stTribute
End Sub


Please Advise...

Thank you.
 
L

Lance McGonigal

I think you'll have to fully qualify both object names
(forms!myform!myobject). I'd also put a requery statement on the combobox
so that when the tribute add for is closed the combobox will requery when
they go to select it.

good luck
 

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