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

Update field in form based on value in a pop up form

Status
Not open for further replies.

spluim

Technical User
May 14, 2003
25
0
0
US
I have a job tracking database that includes a customer subform. When a user adds a new customer they click a button that opens a pop up form. After entering the info, the customer ID is entered into the base form.

The problem is that the name of the base form may vary depending on the type of job. Please help me with coding so that the field it updates is based on the current form.

Follows is my code. I receive an error "object Required"

Private Sub cmdClose_Click()
On Error GoTo Err_CmdClose_Click

Dim Temp As Integer
Dim frmCurrentForm As Form

'Assign the new Rolodex ID to a temp holding spot
Temp = [intRolodex_ID]
'Close the Pop Up form
DoCmd.Close

'Assign the name of the main form
Set frmCurrentForm = Screen.ActiveForm

Set frmCurrentForm![intRolodex_ID] = Temp


Exit_CmdClose_Click:
Exit Sub

Err_CmdClose_Click:
MsgBox Err.Description
Resume Exit_CmdClose_Click

End Sub
 
Replace this;
Set frmCurrentForm![intRolodex_ID] = Temp
By this:
frmCurrentForm("intRolodex_ID") = Temp

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top