Query problem. Access is my nightmare.

P

p-rat

I have a parameter query set up. It prompts me for a Ticket Number. It
works fine. I want to set-up a macro or something that I can run from
my switchboard. Edit Ticket Number. I set it up and it will allow any
number to be put in and it will pull up all records. How do I set this
up from my switch board to where someone types the Ticket Number into
the parameter window and it only pulls up that record or comes back
with an error message saying "record not found"?
 
S

SDCT

I have a parameter query set up. It prompts me for a Ticket Number. It
works fine. I want to set-up a macro or something that I can run from
my switchboard. Edit Ticket Number. I set it up and it will allow any
number to be put in and it will pull up all records. How do I set this
up from my switch board to where someone types the Ticket Number into
the parameter window and it only pulls up that record or comes back
with an error message saying "record not found"?

If you are displaying the records in a form,

Sub EditTicket_Click()

Dim strTicket as string

strTicket = InputBox("Enter Ticket #:")

if isnull(dlookup("[ticket]","[yourtablename]", "[ticket] = '" &
strTicket & "'")) then

msgbox "record not found"

else

docmd.applyfilter , "ticket = '" & strTicket & "'"

end if

I think that should work.
 

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