Why does this code not work.....(Access 2000)

G

Guest

Hello all,

I really hope some one can help me. I have been gaing fast over the last
couple of days trying to get the code list at the bottom to work properly.

I am writing a data scoring database and I am struggling on a certain rule.
The database loops through a list of new contacts and for each one then
loops through each field and again through any rule set up against the field.

I am trying to check whether the new contacts email address (fldfield.value)
ends with a suitable email ending. I have done this by having a list of
rules with a unique rule identifier which then links to another table (by
rule identifier) with items to look for;

So...rstfieldrules RuleIdentifier 12

rstListItems....

RuleLink RuleValue
12 .com
12 .co.uk

This is my code...note this is my first ever datasbase so it probably not
very effient.

Set db = CurrentDb()
Set RS4 = db.OpenRecordset("tblListItems", dbOpenDynaset)
ListCriteria = "RuleLink like " & rstFieldRules!RuleIdentifier
RS4.MoveFirst
RS4.FindFirst ListCriteria
If InStr(1, RS4!RuleValue, fldfield.Value) > 0 Then GoTo
CloseCase11
'fldfield.value is the email address in this case picked up
from the new contact
Do Until RS4.NoMatch
RS4.MoveNext
RS4.FindNext Criteria
If InStr(1, RS4!RuleValue, fldfield.Value) > 0 Then GoTo
CloseCase11
Loop
'******************
'Item was not found
'******************

DataScore = DataScore - ScoreDeduction
blnFieldHasError = True
DoesNotApply = False

'***********
CloseCase11:
'***********

RS4.Close
Set RS4 = Nothing


Not only is the routine considerably slowing down the whole process but...it
is not identifying any correct email addresses. Please, please tell me where
I am going wrong
 
J

Jeff Boyce

Sean

I'm not quite clear on what you are trying to accomplish.

Is there a chance you could be using a query to update a set of records,
rather than iterating through a recordset. If the query would do what you
need, it should be much faster.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top