IIf & qryCount

  • Thread starter Thread starter don
  • Start date Start date
D

don

Hi,

I would like to be able to use a single command button to either view
records on a form if they exist or go to a new record form if they
dont. I've created a qryCount but when I tried adding this to my
search form it restricted search results to a single return and I've
tried using If then else in VBA but have gone wrong there too.

Any help would be appreciated.

DonH
 
Use find and find Next like below to perform a multiple search

With Worksheets(1).Range("a1:a500")
Set c = .Find(2, lookin:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
c.Value = 5
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With

Sorry to ask is this Access? looks like excel with the range and
worksheet reference.
 
Back
Top