UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> User-defined Type Not Defined Here But Not There, Access 2013    
 
   
Leah
post Feb 23 2018, 03:00 PM
Post#1



Posts: 768
Joined: 22-February 00
From: New York, New York


I copied this code below from a different Access database that someone had helped me with a while back. I thought it would be nice to do a log for this new thing I am trying to put together. The debugger said "User-defined type not defined." It does not say that in the original file that I copied the code from so I must be missing something. Is there a different definition I could use or what do I need to do so that Access is happy with me?

Thanks

Leah


Option Compare Database
Dim LogFile As TextStream

' Make sure that this following is Checked.
' Tools>References>Microsoft Scripting Runtime

Sub ExecuteQuery(qryNames() As String)
For i = 0 To UBound(qryNames)
'Debug.Print qryNames(i)
LogFile.WriteLine "Running: " & qryNames(i) & " -- " & Now()
DoCmd.SetWarnings False
DoCmd.OpenQuery qryNames(i)
DoCmd.SetWarnings True
Next
End Sub
Go to the top of the page
 
theDBguy
post Feb 23 2018, 03:20 PM
Post#2


Access Wiki and Forums Moderator
Posts: 73,950
Joined: 19-June 07
From: SunnySandyEggo


Hi Leah,

Where is the error coming from? Do you have a Reference set to Microsoft Scripting Runtime?
Go to the top of the page
 
Leah
post Feb 23 2018, 03:28 PM
Post#3



Posts: 768
Joined: 22-February 00
From: New York, New York


Probably not, but I don't know where it is set up. Presumably it is in the first database somewhere.

Leah
Go to the top of the page
 
zaxbat
post Feb 23 2018, 07:16 PM
Post#4



Posts: 1,184
Joined: 26-January 06
From: .....the wiregrass (either you know or you don't)


Supporting code from the microsoft scripting runtime library (that contains your missing type definition) must be included for your VBA to compile and run.

If you click alt-f11 you can open the VBA interface.

Then from the main menu you need to go to tools then references and scroll down and click the box for 'microsoft scripting runtime' then click ok.

Hopefully that is all that was missing....so try to run it again after that.
Go to the top of the page
 
GroverParkGeorge
post Feb 24 2018, 09:29 AM
Post#5


UA Admin
Posts: 34,113
Joined: 20-June 02
From: Newcastle, WA


Attached File  References.jpg ( 103.15K )Number of downloads: 0
Go to the top of the page
 
Leah
post Feb 26 2018, 10:16 AM
Post#6



Posts: 768
Joined: 22-February 00
From: New York, New York


Thanks everyone, I found tools references and added it and all is well. Is there a reason why this stuff isn't just there to begin with?

Leah
Go to the top of the page
 
zaxbat
post Feb 26 2018, 10:34 AM
Post#7



Posts: 1,184
Joined: 26-January 06
From: .....the wiregrass (either you know or you don't)


Sure. It's like a toolbox. If you are a tool junkie like I am you do not just have one tool box. You have several and each box has a specific set of tools designed for certain jobs. When you go out on a job you might take all of your toolboxes...but probably not that is a big burden in so many ways. Kind of the same with programming tools, utitilities, 3rd party routines. The more specialized items (seldom used) are ignored at run/compile time to speed things up and keep your app smaller.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    14th December 2018 - 02:13 PM