Solved

Reguar Expression in a Module

Posted on 2004-08-27
10
197 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
ID: 11912707
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
ID: 11912762
where do i find the .dll and how can i distribute it?
0
 
LVL 44

Expert Comment

by:GRayL
ID: 11912769
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 11912955
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
ID: 12113392
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
ID: 12857824
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
ID: 12858064
ok sounds fair enough, I must have missed those 4 days warning due to fault of my own. never mind then :-)
0

Featured Post

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

803 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