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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set a field on a form based on value from another form

Status
Not open for further replies.

Grieg

Technical User
Sep 13, 2002
20
GB
Hi,

I have 2 forms ('client' & 'review'). Both forms are based on seperate tables however both have a field 'policy' which links the two.

When I click on a button ('addreview') on the client form I need this to open a new record on the review form. I also need the field 'policy' to be set to the value which was in 'policy' in the 'client' form.

So far this is the code I have;

Private Sub addreview_Click()

DoCmd.OpenForm ("review")
DoCmd.GoToRecord acDataForm, "review", acNewRec

DoCmd.Close acForm, "client"

End Sub

This opens the new form & goes to a new record however I'm having trouble setting the 'policy' field based on data in the 'client' form.

I'm wondering if I should use a public variable to transfer data from one form to the other however I haven't had much success with this.

Any help\guidance would be appreciated.

Grieg.
 
DoCmd.OpenForm ("review")
DoCmd.GoToRecord acDataForm, "review", acNewRec
Forms("review")("policy")= Me("policy")
DoCmd.Close acForm, "client"


should work...

[pipe]
Daniel Vlas
Systems Consultant
danvlas@yahoo.com
 
Excellent, that works a treat - many thanks.

Grieg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top