Re: Searching And Checking Rules Depenging On Rule
- From: Vincent Johns <vjohns@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 01 Dec 2005 00:08:00 GMT
SEAN DI''''ANNO wrote:
ok.really trying hard and it has taken me all day to come up with
Dim MyDB As Database Dim MyRecSet As Recordset
Point of style: I'm not happy with this name. Could you come up with something more suggestive, such as UsersFaultSpecifications? You read at least two Recordsets and you probably write one, so I think their names should convey a sense of what each one's purpose is.
Dim SQLString As String
Dim Criteria As String
Set MyDB = CurrentDb()
Set MyRecSet = MyDB.OpenRecordset("FaultItems", dbOpenDynaset)
You don't need Dynaset; Snapshot should suffice, since you're only going to look at them, not change them. However, you might want to store your scores in the Table of data that you're testing using these criteria, so that recordset might need to be a Dynaset, if you want to store the results there.
Criteria = "FieldName like " & "'" & fldField.Name & "'" MyRecSet.FindFirst Criteria Do Until MyRecSet.NoMatch
MyRecSet.FindNext Criteria
Loop
Am I on the right lines? if the field name is found then do some function depnding on the rule and value of fldfield.value?
Something like this. There are probably various ways to proceed, but I'd choose a record in the Table containing the data, then loop through the list of criteria. For each criterion, fetch the value specified field in the data record (but with care; some may be text strings, others may be numbers) and apply the specified criterion to that value. You'll have to decide how to do that, and you may need to do some error checking on the criteria themselves to be sure that they are expressed clearly. This should be a fun challenge. I suggest you start simply, perhaps by specifying strings that would make sense in a "Like ...." clause, or maybe even by restricting the choices to exact matches until you have your system debugged.
Anyway, having gone through all the criteria for that record, I'd assign a score to it, then repeat all this with the next record.
You can do a couple of things with the score that you compute: store it into a field in the Table of data, store it (with a copy of the primary key value) into a separate Table of scores, or return it as a value of your function. In this last case, your function could store the values into an array to be returned when you've read all the records, or you could return just one value for each function call (but then the calling program would probably need to open the recordset of user data, call the function once for each record, and close the recordset).
-- Vincent Johns <vjohns@xxxxxxxxxxxxxxxxxx> Please feel free to quote anything I say here.
.
- References:
- RE: Searching And Checking Rules Depenging On Rule
- From: SEAN DI''''ANNO
- RE: Searching And Checking Rules Depenging On Rule
- Prev by Date: Re: if/then conditional statement help
- Next by Date: Re: Searching And Checking Rules Depenging On Rule
- Previous by thread: RE: Searching And Checking Rules Depenging On Rule
- Next by thread: Re: Searching And Checking Rules Depenging On Rule
- Index(es):
Relevant Pages
|