Go Back   Access World Forums > Microsoft Access Discussion > Forms

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-03-2019, 08:50 AM   #1
AlbertoG
Newly Registered User
 
Join Date: Oct 2019
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
AlbertoG is on a distinguished road
Open a form and pass a number to it

Hello. I want to open an existing form from VBA and pass a number to it, so that it is used by some of its controls: combo boxes, lists and associated VBA routines.

--------------
Current code:
Dim strW As String


strW = "[Stk_ID] = " & CStr(Me.Chosen_Stk_ID)

DoCmd.OpenForm "Stk_QAs_Form", acNormal, , strW
--------------
Results:
At the debugger window, strW is "[Stk_ID] = 6"
But when the form Stk_QAs_Form opens, it asks for the value of Stk_ID.
Even if I write a number at the input box, it is reflected in the control Stk_ID.

Any ideas?

AlbertoG is offline   Reply With Quote
Old 10-03-2019, 08:54 AM   #2
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,885
Thanks: 57
Thanked 1,287 Times in 1,268 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Open a form and pass a number to it

Hi.You're using the WhereCondition argument to pass a filter to the form you're opening. Perhaps you meant to use the OpenArgs argument to pass the value of Stk_ID instead. Just a thought...
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 10-03-2019, 08:57 AM   #3
AlbertoG
Newly Registered User
 
Join Date: Oct 2019
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
AlbertoG is on a distinguished road
Re: Open a form and pass a number to it

Thank you, theDBguy. I will try it.

AlbertoG is offline   Reply With Quote
Old 10-03-2019, 09:06 AM   #4
theDBguy
Iím here to help
 
theDBguy's Avatar
 
Join Date: Oct 2018
Location: SunnySandyEggo
Posts: 5,885
Thanks: 57
Thanked 1,287 Times in 1,268 Posts
theDBguy has a spectacular aura about theDBguy has a spectacular aura about
Re: Open a form and pass a number to it

Quote:
Originally Posted by AlbertoG View Post
Thank you, theDBguy. I will try it.
Hi. You're welcome. Let us know how it goes.
__________________
Just my 2 cents...

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
theDBguy is online now   Reply With Quote
Old 10-03-2019, 09:12 AM   #5
arnelgp
error reading drive A:
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 8,568
Thanks: 68
Thanked 2,744 Times in 2,629 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Open a form and pass a number to it

is the recordsource of the form you are trying to open is
based on a query. check the query for the parameter.

__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
Reply

Tags
form , number , open , pass

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass value from cbo to query to open form Zydeceltico Forms 1 03-11-2019 10:18 AM
Open a query from a form and pass criteria through MattioMatt Queries 4 03-06-2018 05:07 PM
open one db form another and pass variable to it Techworks Modules & VBA 10 04-21-2014 04:36 PM
Open form and pass data dcjones Forms 3 04-19-2006 02:55 PM
Pass The Test for Form Open RNCIENG Forms 3 05-22-2002 08:26 AM




All times are GMT -8. The time now is 05:06 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World