Solved

Use value from subform control on the subform

Posted on 2012-03-22
3
288 Views
Last Modified: 2012-03-22
I have a subform that lists user names, their id and if they have job titel or not.  I also have an edit button next to the rowon the subform.  Iwant the use to be able t hit this "edit" button and have another form open to the approriate record for the employee.  But I think I am trying to reference teh control incorrect as what I have does not work.  I am assumeing ME refers to the parent form, frmEmpsNoJobId is the subform and EmpUserID is the text control on the subform that I want to use as the parameter to open the frmEmployees.  This is on an Access 2003 form using VBA

Sandra


Private Sub cmdEditJob_Click()
 DoCmd.OpenForm "frmEmployees", , , "[EmpUserID]=
" & Me!frmEmpsNoJobID.Form!EmpUserID
End Sub
0
Comment
Question by:ssmith94015
  • 2
3 Comments
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 37754648
sb

 DoCmd.OpenForm "frmEmployees", , , "[EmpUserID]=" &Me.EmpUserID

If ID is numeric

or this if it is a string:
 DoCmd.OpenForm "frmEmployees", , , "[EmpUserID]=" & "'" & Me.EmpUserID &"'"
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 37754653
better:

sb

 DoCmd.OpenForm "frmEmployees", , , "[EmpUserID]=" & Me.EmpUserID
If EmpUserID is numeric

or this if EmpUserID is a string:
 DoCmd.OpenForm "frmEmployees", , , "[EmpUserID]=" & "'" & Me.EmpUserID &"'"
0
 

Author Closing Comment

by:ssmith94015
ID: 37754775
Was missing the string aspect.

Sandra
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now