?
Solved

Use value from subform control on the subform

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

650 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