Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Reguar Expression in a Module

Posted on 2004-08-27
Last Modified: 2012-06-27

How do I create a regular expresion like I can do in VBs aswell?
Question by:DaFou
  • 4
  • 2
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.

Author Comment

ID: 11912762
where do i find the .dll and how can i distribute it?
LVL 44

Expert Comment

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.
Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

LVL 84

Accepted Solution

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:

Author Comment

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?


Author Comment

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

Author Comment

ID: 12858064
ok sounds fair enough, I must have missed those 4 days warning due to fault of my own. never mind then :-)

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

791 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