D
don
Hi Group,
I'm using a piece of VBA I got from Allen Brows web site to construct
a search. It works fine but my needs have changed a little and I'm
trying to modify it. I have an address Db with a local area and town
field unfortunatley what the user might consider is the town is the
local area and possibly vice versa. I would therefore like to be able
to search using the same system but be able to check in both local
area and town. The original VBA is below along with a couple of my
attempts. Can I do it like this or is my thinking wrong. At present
my knowledge of VBA as can probably be seen from my attempts is very
limited.
If Not IsNull(Me.txtTown) Then
strWhere = strWhere & "([Town] = """ & Me.txtTown & """) AND "
End If
If Not IsNull(Me.txtTown) Then
strWhere = strWhere & "([Locality] = """ & Me.txtTown & """)
AND "
'''''' ElseIf Not IsNull(Me.txtTown) Then
strWhere = strWhere & "([Town] = """ & Me.txtTown & """) AND "
End If
Don
I'm using a piece of VBA I got from Allen Brows web site to construct
a search. It works fine but my needs have changed a little and I'm
trying to modify it. I have an address Db with a local area and town
field unfortunatley what the user might consider is the town is the
local area and possibly vice versa. I would therefore like to be able
to search using the same system but be able to check in both local
area and town. The original VBA is below along with a couple of my
attempts. Can I do it like this or is my thinking wrong. At present
my knowledge of VBA as can probably be seen from my attempts is very
limited.
If Not IsNull(Me.txtTown) Then
strWhere = strWhere & "([Town] = """ & Me.txtTown & """) AND "
End If
If Not IsNull(Me.txtTown) Then
strWhere = strWhere & "([Locality] = """ & Me.txtTown & """)
AND "
'''''' ElseIf Not IsNull(Me.txtTown) Then
strWhere = strWhere & "([Town] = """ & Me.txtTown & """) AND "
End If
Don