Buildcriteria DataTypes

mary.h

Registered User.
Local time
Today, 13:25
Joined
Aug 21, 2003
Messages
48
Hello,

I am trying to rebuild the Query-by-Form menu function in order to have it working in a runtime version.

I try to run through my controls-collection of the form and add all the user inputs to one filter criteria. In order to do that I have to check, whether the datatype of the control is dbText, dbLong or dbBoolean. How can I do that.

Here part of my code:

for each ctl in frm1
if ??? = dbText then
strFilter = strFilter & " AND " & BuildCriteria(ctl.Name, dbText, ctl.Value)
else
if ??? = dbLong then
strFilter = strFilter & " AND " & BuildCriteria(ctl.Name, dbLong, ctl.Value)
else
 
sorry that one prior was posted to early by error.

code ...
and so on... closing - of course the ifs and next loop.

So my problem is how to refer to the datatype of the control.

I am very greatful for any ideas.

Thanks in advance.
Mary
 
Controls can display all sorts of different data. i.e. a textbox can display text, numbers, currency, hyperlinks, etc.

Simply, for text put a phrase in each control on your form's Tag property

ie.

Put TEXT in a control where you expect text
Put LONG in a control....etc..

Code:
For Each ctl In frm1 
    Select Case ctl.Tag
        Case Is = "TEXT"
            strFilter = strFilter & " AND " & BuildCriteria(ctl.Name, dbText, ctl.Value) 
        Case Is = "LONG"
            strFilter = strFilter & " AND " & BuildCriteria(ctl.Name, dbLong, ctl.Value) 
        Case Else
            ' etc, other conditions
    End Select
Next
 

Users who are viewing this thread

Back
Top Bottom