Solved

Use value from subform control on the subform

Posted on 2012-03-22
3
289 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

867 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

15 Experts available now in Live!

Get 1:1 Help Now