Can Open Args capture combo box values?

ST4RCUTTER

Registered User.
Local time
Today, 01:22
Joined
Aug 31, 2006
Messages
94
I created a combo box with several name values. I want to capture the value selected using open arguments and then pass it (via open argument) to another form for display in another text box. This is essentially an, "Are you sure you want this value" form. I looks like open arguments are hard coded from the other posts I've read. Can I do something like this?

DoCmd.OpenForm frm_popup, , , , , , Me.cbo_reassign


And then on the popup form have code for a textbox called "txb_verifyname"

Me.txb_verifyname.Value = Me.OpenArgs
 
Last edited:
You should be able to do that, yes.
 
You were correct pbaldy, this did work! Thank you.

After looking at this though, I think there may be a more elegant solution. Since the pop up form I'm opening is record sourced from a query which has a field that matches the value I'm storing in the OpenArg value, using the WhereCondition may work just as well. With this in mind I adjusted my code on the first form to:

Code:
DoCmd.OpenForm "frm_reassign_task", acNormal, , (Me.cbo_reassign)

Now the only problem is that this is not filtering the second pop up form. I think this is because Access doesn't know that value in Me.cbo_reassign should correspond to the [UserID] field in the record source for the pop up.

My question is, how do I tell the form that the value in the WhereCondition should be equal to the [UserID] field in the query which is the recordsource for the pop up form?
 
To add to Paul's post ...

Note, that OpenArgs can be used like a variable within the form that you passed it to. So in Paul's how-to you can use it as noted in the following ...

Code:
Dim sFormName As String
Dim sCriteria As String
 
sFormName = "PopUpForm2"
sCriteria = "[UserID]=" [COLOR=red]Me.OpenArgs[/COLOR]    
 
DoCmd.OpenForm sFormName, , , sCriteria

-dK
 
Not on?!? Beat ya by 6 minutes! :p
 
Hehehe ... after I posted, I noticed my error because seeing is believing ... so went back and revised :D
 
Oh, editing is dirty pool! I think ST4RCUTTER is getting away from the OpenArgs, unless I misread, plus you probably want to throw an ampersand in there ;) , so:

sCriteria = "[UserID]=" & Me.cbo_reassign
 
Thanks guys. I think you have given me all I need to fix my problem.
 
Ah! Missed the ampersand ....

I don't know if trying to get away from the OpenArgs, either - I read that there would be a pop-up to a pop-up hence the usage. If not, agree with your straight assignment.

The only way I can think of to get away from OpenArgs completely is to refer to open form underneath the pop-ups .. Forms!UnderlyingForm!cbo_reassign.

-dK
 

Users who are viewing this thread

Back
Top Bottom