Solved

Use value from subform control on the subform

Posted on 2012-03-22
3
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
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…

717 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