Solved

Reguar Expression in a Module

Posted on 2004-08-27
10
195 Views
Last Modified: 2012-06-27
Ola,

How do I create a regular expresion like I can do in VBs aswell?
0
Comment
Question by:DaFou
  • 4
  • 2
10 Comments
 
LVL 84
Comment Utility
You need to set a reference to the Microsoft VBScript Regular Expressions 5.5 (the latest version), then do the same thing as you would in VB:

Dim varRegex As Regex

and use it to do whatever. Note, however, that RegExs are not specifically supported in VBA, and if you intend to distribute this to end users you'll end up with trouble when attempting to reference this ... notice that when you set this reference, the "location" specified ends with a number 3 ... this is the "entry point" into the dll that parses regular expressions, and if you simply distribute your db to others, you'll find that this reference will NOT transfer over in every case ... why this is I don't know, but I had this bite me a year or so back.
0
 
LVL 2

Author Comment

by:DaFou
Comment Utility
where do i find the .dll and how can i distribute it?
0
 
LVL 44

Expert Comment

by:GRayL
Comment Utility
Every MDB file can associate with a module if one is created. In database view click on modules. If one has been created, you will see it named here. Else click on New and you can create a new one. The module can contain subroutines and functions. Here you declare a function or subroutine, dimension any variables used in the routine and add the code to accomplish the intent of the sub or function. There is a lot of help in VB help on these matters. You can get to the VB Editor by typing Ctl-G or Alt-F11. Here you will see the code window and the Immediate Pane in which you can test various code snippets as you develop your code. Hope this helps.
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
You don't install JUST vbscript ... you have to install the entire Windows Scripting Host (WSH) which is pretty invasive. Of course, any machine with IE on it has the necessary dll files, so you could hedge your bets and assume that the user hasn't "unregistered" this ... other problems include admins turning off execution of VBScripts, anti-viruse programs that will "catch" your vbscript, etc etc ... and, as I said, RegExs aren't directly supported in VB/VBA, therefore you're working in uncharted territory ... this isn't to say programmers don't do this, just that it's not supported.

FWIW there is a component that claims to mimci the functions of Regular Expressions:
http://www.aivosto.com/regexpr.html
0
 
LVL 2

Author Comment

by:DaFou
Comment Utility
WHat to do if I have MS IE 6.0 installed but Microsoft VBScript Regular Expressions 5.5.dll does nto show up in my references?

0
 
LVL 2

Author Comment

by:DaFou
Comment Utility
what? this is evil. this questin has not been answerd and abandoned by the experts not me.....
totally unaceptable by principle. how about opening this question up again and this guys you gave the points can keep the points. also you can take extra points from me to reopen this question
0
 
LVL 2

Author Comment

by:DaFou
Comment Utility
ok sounds fair enough, I must have missed those 4 days warning due to fault of my own. never mind then :-)
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now