?
Solved

Use value from subform control on the subform

Posted on 2012-03-22
3
Medium Priority
?
301 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Sometimes MS breaks things just for fun... In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset. Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters. So, …
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

850 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