Hi All,
I have the current Sub Procedure in a VBA Module.
-----------------------------------------------------------------------------------------------------------------------------
Sub openForm(formName As String, Optional varToSend As Object)
If varToSend Is Missing Then
DoCmd.openForm formName
Else
DoCmd.openForm formName, , , , , , varToSend
End If
End Sub
----------------------------------------------------------------------------------------------------------------------------
>From a button on "frmDash" I call: openForm("frmEmployeeAdjust") -
This Works Great
But when I call: openForm("frmEmployeeAdjust",empNo) - I get an Error
"Expected: = "
I know I could just write the code in the button and everything would
work, but I would like to write this simple function that I could call
anytime I needed to open a form. I always thought Object was generic
enough to contain any data type that exists, so I should be ok weather
I pass an Integer, String, Etc. Am I doing something blantantly wrong
here?
As always, Thanks in advance for all of your help! 3 4109
Remove your brackets after "OpenForm". VBA Compiler thinks you're
calling a function.
On Feb 28, 2:42 pm, "Matt" <mdw233...@yahoo.comwrote:
Hi All,
I have the current Sub Procedure in a VBA Module.
---------------------------------------------------------------------------*--------------------------------------------------
Sub openForm(formName As String, Optional varToSend As Object)
If varToSend Is Missing Then
DoCmd.openForm formName
Else
DoCmd.openForm formName, , , , , , varToSend
End If
End Sub
---------------------------------------------------------------------------*-------------------------------------------------
From a button on "frmDash" I call: openForm("frmEmployeeAdjust") -
This Works Great
But when I call: openForm("frmEmployeeAdjust",empNo) - I get an Error
"Expected: = "
I know I could just write the code in the button and everything would
work, but I would like to write this simple function that I could call
anytime I needed to open a form. I always thought Object was generic
enough to contain any data type that exists, so I should be ok weather
I pass an Integer, String, Etc. Am I doing something blantantly wrong
here?
As always, Thanks in advance for all of your help!
On Feb 28, 2:42 pm, "Matt" <mdw233...@yahoo.comwrote:
>
Hi All,
I have the current Sub Procedure in a VBA Module.
---------------------------------------------------------------------------*--------------------------------------------------
Sub openForm(formName As String, Optional varToSend As Object)
If varToSend Is Missing Then
DoCmd.openForm formName
Else
DoCmd.openForm formName, , , , , , varToSend
End If
End Sub
---------------------------------------------------------------------------*-------------------------------------------------
>From a button on "frmDash" I call: openForm("frmEmployeeAdjust") -
This Works Great
But when I call: openForm("frmEmployeeAdjust",empNo) - I get an Error
"Expected: = "
I know I could just write the code in the button and everything would
work, but I would like to write this simple function that I could call
anytime I needed to open a form. I always thought Object was generic
enough to contain any data type that exists, so I should be ok weather
I pass an Integer, String, Etc. Am I doing something blantantly wrong
here?
As always, Thanks in advance for all of your help!
On Feb 28, 3:24 pm, "Jason Lepack" <jlep...@gmail.comwrote:
Remove your brackets after "OpenForm". VBA Compiler thinks you're
calling a function.
"Use of Parentheses in Procedure Calls:
It is sometimes confusing to determine when to use, or not to use,
parentheses ( ) to enclose argument lists with a VBA subroutine or
function.
For example, subroutines or functions that do not receive arguments in
VBA do not require parentheses. Otherwise, parentheses are required in
the declaration. When calling a subroutine, you can either call the
subroutine directly by name, or you may call it by using the Call
statement. When calling a subroutine directly, you never use
parentheses. When using the Call statement to call a function that
takes arguments, you must use parentheses. When using the Call
statement to call a function that does not take arguments, you do not
use parentheses."
<whew>
On Feb 28, 3:53 pm, "robert.waters" <robert.wat...@gmail.comwrote:
On Feb 28, 2:42 pm, "Matt" <mdw233...@yahoo.comwrote:
Hi All,
I have the current Sub Procedure in a VBA Module.
---------------------------------------------------------------------------**--------------------------------------------------
Sub openForm(formName As String, Optional varToSend As Object)
If varToSend Is Missing Then
DoCmd.openForm formName
Else
DoCmd.openForm formName, , , , , , varToSend
End If
End Sub
---------------------------------------------------------------------------**-------------------------------------------------
From a button on "frmDash" I call: openForm("frmEmployeeAdjust") -
This Works Great
But when I call: openForm("frmEmployeeAdjust",empNo) - I get an Error
"Expected: = "
I know I could just write the code in the button and everything would
work, but I would like to write this simple function that I could call
anytime I needed to open a form. I always thought Object was generic
enough to contain any data type that exists, so I should be ok weather
I pass an Integer, String, Etc. Am I doing something blantantly wrong
here?
As always, Thanks in advance for all of your help!
On Feb 28, 3:24 pm, "Jason Lepack" <jlep...@gmail.comwrote:
Remove your brackets after "OpenForm". VBA Compiler thinks you're
calling a function.
"Use of Parentheses in Procedure Calls:
It is sometimes confusing to determine when to use, or not to use,
parentheses ( ) to enclose argument lists with a VBA subroutine or
function.
For example, subroutines or functions that do not receive arguments in
VBA do not require parentheses. Otherwise, parentheses are required in
the declaration. When calling a subroutine, you can either call the
subroutine directly by name, or you may call it by using the Call
statement. When calling a subroutine directly, you never use
parentheses. When using the Call statement to call a function that
takes arguments, you must use parentheses. When using the Call
statement to call a function that does not take arguments, you do not
use parentheses."
<whew>- Hide quoted text -
- Show quoted text -
Whew is right ... but it helped a ton. Thanks to both of you!!!!! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: andreas |
last post by:
Hi there,
I have the following situation:
1. DOT.NET Application is started
2. DOT.NET Application instantiates Access.Application.8
3. Opens a specified database (MDB)
4. DOT.NET...
|
by: jr |
last post by:
Sorry for this very dumb question, but I've clearly got a long way to go!
Can someone please help me pass an array into a function. Here's a starting
point.
void TheMainFunc()
{
// Body of...
|
by: Mike MacSween |
last post by:
Just spent a happy 10 mins trying to understand a function I wrote sometime
ago.
Then remembered that arguments are passed by reference, by default.
Does the fact that this slowed me down...
|
by: PJS |
last post by:
I am trying to use a COM object which has a parameter of type Collection in
VB6. .Net recognizes this collection as a VBA.Collection object. When I try
creating a VBA.Collection in .Net using:
...
|
by: John Pass |
last post by:
Hi,
In the attached example, I do understand that the references are not changed
if an array is passed by Val. What I do not understand is the result of line
99 (If one can find this by line...
|
by: Deano |
last post by:
Apparently you can only do this with one value i.e Call
MyAssetLocationZoom(Me!txtLocation, "Amend data")
This runs;
Public Sub MyAssetLocationZoom(ctl As Control, formName As String)
On...
|
by: Lucy Ludmiller |
last post by:
I have a class CMyObject, that I want to pass in an ActiveX event.
I have not as yet found a way of passing pointers in events - any one
knows how ?
//PseudoCode IDL
void...
|
by: Greger |
last post by:
Hi,
I am building an architecture that passes my custom objects to and from
webservices. (Our internal architecture requires me to use webservices to any
suggestion to use other remoting...
|
by: VaBa |
last post by:
Hi,
Need some help.. I have a VBA class module in MS ACCESS. In the same MS ACCESS app, I am calling a .NET DLL (which i have exposed as COM-visible) and passing BYREF an instance of the VBA class...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |