Why It throw an error of <Object variable or With block variable not set>
set objAccess = GetObject(strMdbPath)
objAccess.DoCmd.SetWarning False
objAccess.DoCmd.OpenReport strReportName, 0
'It is fine until now
objAccess.Application.Run "Function",Arg1,Arg2
'Throw the arror
<Object variable or With block variable not set>
I
4 3459 NeoPa 32,556
Expert Mod 16PB
You have (accidentally) posted this question in the Access Articles section. This is NOT an article.
I'm moving this to the main Access questions forum.
MODERATOR.
NeoPa 32,556
Expert Mod 16PB
Why It throw an error of <Object variable or With block variable not set>
set objAccess = GetObject(strMdbPath)
objAccess.DoCmd.SetWarning False
objAccess.DoCmd.OpenReport strReportName, 0
'It is fine until now
objAccess.Application.Run "Function",Arg1,Arg2
'Throw the arror
<Object variable or With block variable not set>
I
Brian, Where is this code? Is it running from within Access?
Hmm, did you try a different name instead of "Function" as it might be a reserved word....
I normally use "fnc" as prefix for a function to have no "reserved words" trouble.
NNic;o)
Why It throw an error of <Object variable or With block variable not set>
set objAccess = GetObject(strMdbPath)
objAccess.DoCmd.SetWarning False
objAccess.DoCmd.OpenReport strReportName, 0
'It is fine until now
objAccess.Application.Run "Function",Arg1,Arg2
'Throw the arror
<Object variable or With block variable not set>
I
The following code will run the Function fTest(Arg1, Arg2) in the C:\Test\Test.mdb External Database. The fTest(Arg1, Arg2) Function is declared Publically in a Standard Code Module. It accepts 2 String Arguments, and simply concatenates them with a space in between. The Code is of course simplistic, but my only intention is to demonstrate to you how can Run a Function or Sub-Procedure in an External Database from your Current Database. Good Luck - hope this is what you were looking for. - Dim strMDBPath As String
-
'Can also be Declared at a Modular level if needed. In its present state,
-
'objAccess goes out-of-scope as soon as the procedure ends.
-
Dim objAccess As Access.Application
-
-
strMDBPath = "C:\Test\Test.mdb"
-
-
Set objAccess = CreateObject("Access.Application")
-
-
objAccess.Visible = True 'not required
-
-
objAccess.OpenCurrentDatabase strMDBPath, False
-
-
objAccess.Run "fTest", "John", "Doe"
-
-
objAccess.CloseCurrentDatabase
-
Set objAccess = Nothing
OUTPUT: Sign in to post your reply or Sign up for a free account.
Similar topics
by: JayBrahms |
last post by:
Hi there.
OK, this is a little bit complicated.
I would live to find a different way to do this, but evidentially I am not able
to open a Text-File in JAVASCRIPT and fill an Array with the...
|
by: Wolfgang Schwanke |
last post by:
Dear usenet,
I'm having the following small problem.
I've been ask to add some Quicktime panoramas to a website. The author of
the panoramas has made two versions of each: One in MOV format,...
|
by: Christopher Benson-Manica |
last post by:
(I posted this as a reply to my thread about iframes, but I think it
may get mostly ignored there.)
http://ataru.gomen.org/files/test.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"...
|
by: KC |
last post by:
Could some one explain to me the casting rules for sending generic lists, ex. List<Person>, to a function that accepts List<object>? I cannot get the following easy-cheesy app to work. I get the...
|
by: msnews.microsoft.com |
last post by:
hello every one
i am using media player in internet explorer but i cannot access it directly
in code behind, so do you know a way to access it?
<object id="video123"...
|
by: å¼ éŸ¡æ¦ |
last post by:
Hello. On one webpage I just worked out, I use svg (by using <object>)
for browser that supports svg (firefox), and give an <imginside of
<objectas a fallback for IE.
...
|
by: Stephan Steiner |
last post by:
Hi
I seem to have a bit of trouble understanding one bit of how generics work:
In C#, every class automatically derives from object, and inherits a bunch
of properties (i.e. ToString()). Thus,...
|
by: Alan Silver |
last post by:
Hello,
I have an <objecttag that is used to display a Flash file. I would
like the whole Flash file to be a link. The obvious thought would be to
do this...
<a...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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?
| |