IIf & qryCount

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
 
D

don

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top