M
Maver911
This question is hard to explain but basically im getting a runtime
error#13 at the bottom where it says: "if strng then". Idk if thats
proper syntax or not but im trying to make it so that i can have a
search and a search criteria withuot doing ALL the different IF
combonations. This is the best way i could think of and it doesnt seem
to like the whole string being the criteria. Could anyone please help
me.
dim strng As String
Set find = CurrentDb.OpenRecordset("Name", dbOpenDynaset)
find.MoveFirst
If chkJob.value = -1 Then
If Len(strng) = 0 Then
strng = "find!title = " & cboJobtitle
Else
strng = strng & " AND find!title = " & cboJobtitle
End If
End If
If chkyears.value = -1 Then
If Len(strng) = 0 Then
strng = "find!yrs = " & txtYrs
Else
strng = strng & " AND find!yrs = " & txtYrs
End If
End If
If chkdegree.value = -1 Then
If Len(strng) = 0 Then
strng = "find!degree = " & cboDegree
Else
strng = strng & " AND find!degree = " & cboDegree
End If
End If
If chkpmi.value = -1 Then
If Len(strng) = 0 Then
strng = "find!title = " & cboJobtitle
Else
strng = strng & " AND find!pmi = " & cboPMI
End If
End If
If chkmort.value = -1 Then
If Len(strng) = 0 Then
strng = "find!mortgage = " & cboMort
Else
strng = strng & " AND find!mortgage = " & cboMort
End If
End If
Do Until find.EOF
If strng Then
ReDim Preserve names(x)
names(x) = find!id
x = x + 1
End If
find.MoveNext
Loop
error#13 at the bottom where it says: "if strng then". Idk if thats
proper syntax or not but im trying to make it so that i can have a
search and a search criteria withuot doing ALL the different IF
combonations. This is the best way i could think of and it doesnt seem
to like the whole string being the criteria. Could anyone please help
me.
dim strng As String
Set find = CurrentDb.OpenRecordset("Name", dbOpenDynaset)
find.MoveFirst
If chkJob.value = -1 Then
If Len(strng) = 0 Then
strng = "find!title = " & cboJobtitle
Else
strng = strng & " AND find!title = " & cboJobtitle
End If
End If
If chkyears.value = -1 Then
If Len(strng) = 0 Then
strng = "find!yrs = " & txtYrs
Else
strng = strng & " AND find!yrs = " & txtYrs
End If
End If
If chkdegree.value = -1 Then
If Len(strng) = 0 Then
strng = "find!degree = " & cboDegree
Else
strng = strng & " AND find!degree = " & cboDegree
End If
End If
If chkpmi.value = -1 Then
If Len(strng) = 0 Then
strng = "find!title = " & cboJobtitle
Else
strng = strng & " AND find!pmi = " & cboPMI
End If
End If
If chkmort.value = -1 Then
If Len(strng) = 0 Then
strng = "find!mortgage = " & cboMort
Else
strng = strng & " AND find!mortgage = " & cboMort
End If
End If
Do Until find.EOF
If strng Then
ReDim Preserve names(x)
names(x) = find!id
x = x + 1
End If
find.MoveNext
Loop