Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data Type problem

Status
Not open for further replies.

Petemush

Technical User
Jun 21, 2002
255
GB
Hi,

I want to carry out a certain process on all the controls on a form so obviously I created a Function for it. I need to do slightly different things though depending on the controls datatype.

Here's partial code:

Private Function Filter_Builder(strSQL As String, field_name As Control, form1 As Form) As String

Dim fieldType As String
fieldType = field_name.DataType

Select Case fieldType
Case "Text"

If Len(strSQL) = 1 Then
strSQL = strSQL & "([" & field_name.Name & "] = '" & Nz(field_name, "") & "')"
Else
strSQL = strSQL & " AND " & "([" & field_name.Name & "] = '" & Nz(field_name, "") & "')"
End If

Case "Memo"

Case "Number"

Case "Currency"

Case "Yes / No"

Case "Date / Time"

End Select

Filter_Builder = strSQL

End Function


Unfortunately when the control is a combo box, I get an error saying that the object doesn't support this property, ie. datatype.

Does anyone know how I can get round this?

Cheers,

Pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top