473,378 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Library or not...

I have an mdb that I am using as a reference for another mdb. How do I tell
if the code I am executing is coming from the library reference or in the
front end mdb? So far I'm using

If CurrentProject.FullName <CodeProject.FunnName then
bIsLibrary = ture
end if
Thanks.

Matthew Wells
Ma***********@FirstByte.net
Jul 9 '07 #1
8 1444
Hi, Matthew.
How do I tell if the code I am executing is coming from the library
reference or in the front end mdb? So far I'm using

If CurrentProject.FullName <CodeProject.FunnName then
bIsLibrary = ture
end if
If these were spelled correctly, then this code would work.

Unless you have the bad habit of naming procedures identically in both the
library and the current database, checking the name of the procedure will
tell you which database the code is being executed from.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
Jul 9 '07 #2
Thanks. How do you check the procedure name from within code? I've never
been able to accomplish this before.

"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AMwrote in
message news:aguki.786$mS3.47@trnddc03...
Hi, Matthew.
>How do I tell if the code I am executing is coming from the library
reference or in the front end mdb? So far I'm using

If CurrentProject.FullName <CodeProject.FunnName then
bIsLibrary = ture
end if

If these were spelled correctly, then this code would work.

Unless you have the bad habit of naming procedures identically in both the
library and the current database, checking the name of the procedure will
tell you which database the code is being executed from.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.


Jul 9 '07 #3
Hi, Matthew.
How do you check the procedure name from within code?
Either use the Module's ProcOfLine Property, or hard code it within the VBA
code.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
Jul 9 '07 #4
Sounds easy, but how do you use that while you're running code? To get this
property, wouldn't you have to dim a variable as a module at the module
level, then open the module you're using to be able to use that property?

Sounds scary!!
"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AMwrote in
message news:HDuki.11941$g44.5659@trnddc02...
Hi, Matthew.
>How do you check the procedure name from within code?

Either use the Module's ProcOfLine Property, or hard code it within the
VBA code.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.


Jul 9 '07 #5
Hi, Matthew.
Sounds easy, but how do you use that while you're running code?
Here is an example, where the MsgBox line of code is on line 20:

Public Function whichProcIsThis() As Boolean

On Error GoTo ErrHandler

Dim mdl As Module

Set mdl = Modules("TestModule")
MsgBox "Currently running the " & mdl.ProcOfLine(20, vbext_pk_Proc) & "
procedure."

CleanUp:

Set mdl = Nothing

Exit Function

ErrHandler:

MsgBox "Error in whichProcIsThis( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp

End Function

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
Jul 9 '07 #6
Thanks!!! I'll give it a try and let you know. BTW, don't you have to open
the module to read from it?

"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AMwrote in
message news:Jtvki.1703$YH3.433@trnddc08...
Hi, Matthew.
>Sounds easy, but how do you use that while you're running code?

Here is an example, where the MsgBox line of code is on line 20:

Public Function whichProcIsThis() As Boolean

On Error GoTo ErrHandler

Dim mdl As Module

Set mdl = Modules("TestModule")
MsgBox "Currently running the " & mdl.ProcOfLine(20, vbext_pk_Proc) & "
procedure."

CleanUp:

Set mdl = Nothing

Exit Function

ErrHandler:

MsgBox "Error in whichProcIsThis( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp

End Function

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.


Jul 9 '07 #7
Hi, Matthew.
BTW, don't you have to open the module to read from it?
Logically, the module is _already_ open because you're running the code in
it. In the example I provided, the whichProcIsThis( ) function is in the
TestModule module.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.
"Matthew Wells" <Ma***********@FirstByte.netwrote in message
news:oJ******************************@comcast.com. ..
Thanks!!! I'll give it a try and let you know. BTW, don't you have to
open the module to read from it?

"'69 Camaro" <Fo**************************@Spameater.orgZERO_SP AMwrote
in message news:Jtvki.1703$YH3.433@trnddc08...
>Hi, Matthew.
>>Sounds easy, but how do you use that while you're running code?

Here is an example, where the MsgBox line of code is on line 20:

Public Function whichProcIsThis() As Boolean

On Error GoTo ErrHandler

Dim mdl As Module

Set mdl = Modules("TestModule")
MsgBox "Currently running the " & mdl.ProcOfLine(20, vbext_pk_Proc) &
" procedure."

CleanUp:

Set mdl = Nothing

Exit Function

ErrHandler:

MsgBox "Error in whichProcIsThis( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
GoTo CleanUp

End Function

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
Blogs: www.DataDevilDog.BlogSpot.com, www.DatabaseTips.BlogSpot.com
http://www.Access.QBuilt.com/html/ex...ributors2.html for contact
info.

Jul 9 '07 #8
"Matthew Wells" <Ma***********@FirstByte.netwrote:
>I have an mdb that I am using as a reference for another mdb. How do I tell
if the code I am executing is coming from the library reference or in the
front end mdb? So far I'm using
CodeDb.Name

See my Add-in Tips, Hints and Gotchas page at
http://www.granite.ab.ca/access/addins.htm for more tips.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
Jul 9 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pieter.breed | last post by:
Hi All, The company I work for has traditionally used COM/ActiveX for the solutions that it provides. We are in the process of moving to .NET and a few applications have been written in VB.NET...
3
by: K.S.Liang | last post by:
Hi all, 1> If there are more than one dynamic linking libraries in the file system, how do I know which one is loaded into system? Any C library or system call can tell me which *.so or *.sl is...
1
by: Jim | last post by:
Have fully operational software package developed on VB.NET that worked until Jan 1 2003, with early stage deployments on Oct 10, Oct 23, Nov 11, Dec 12 and Dec 30. When attempted final...
10
by: mwt | last post by:
So in a further attempt to learn some Python, I've taken the little Library program (http://groups.google.com/group/comp.lang.python/browse_thread/thread/f6a9ccf1bc136f84) I wrote and added...
10
by: Julian | last post by:
I get the following error when i try to link a fortran library to a c++ code in .NET 2005. LINK : fatal error LNK1104: cannot open file 'libc.lib' the code was working fine when built using...
20
by: Frank-O | last post by:
Hi , Recently I have been commited to the task of "translating" some complex statistical algorithms from Matlab to C++. The goal is to be three times as fast as matlab ( the latest) . I've...
6
by: =?Utf-8?B?WW9naSBXYXRjaGVy?= | last post by:
Hello, I am using Visual Studio-2003. I created a project to build my library. Since I am using third party libraries as well, I have specified those additional library dependencies in project...
0
by: JosAH | last post by:
Greetings, the last two article parts described the design and implementation of the text Processor which spoonfeeds paragraphs of text to the LibraryBuilder. The latter object organizes, cleans...
0
by: JosAH | last post by:
Greetings, welcome back; above we discussed the peripherals of the Library class: loading and saving such an instantiation of it, the BookMark interface and then some. This part of the article...
16
by: Xiaoxiao | last post by:
Hi, I got a C library, is there a way to view the public function names in this library so that I can use in my C program? Thanks.
1
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...
0
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.