Macro to search multiple records in a subform.

scottk

Registered User.
Local time
Today, 16:11
Joined
Aug 20, 2001
Messages
29
I am attempting to make a macro that will check data in a subform for a specific value.

The macro I have is:

Condition:
[Forms]![Personal Data Entry with Senate and House]![Category Link Subform1].[Form]![Category ID]="FRI"

Action:
MsgBox
Message - Data Found

Condition:
...

Action
StopMacro

Conditon:

Action
MsgBox
Message - Data Not found.

Ok. The macro works fine with one exception. The Category filed that is being searched may contain several records. I have encountered the following problem. If "Fri" is the only catagory that the person belongs to, the macro works fine. However, if the person belongs to several catagories, the statement returns as not true and I recieve the "data not found" message even if one of the catagories is "Fri." How can I eliminate this problem?

Thanks for any help you can give me.
 
I am not very used to Macro, but what you show does not perform a search. It just grabs the value present in ONE control (categoryID) on a subform. If you have many record on this subform (continuous subform) it will pick the value in one of the sections and not perform a search through all.
You have to find a macro instruction that performs search instead of using a condition.
Also, it may eventually be easier to search the underlaying record source of your subform than the subform itslef.

Alex


[This message has been edited by Alexandre (edited 09-04-2001).]

[This message has been edited by Alexandre (edited 09-05-2001).]
 

Users who are viewing this thread

Back
Top Bottom