Query problem. Access is my nightmare.

  • Thread starter Thread starter p-rat
  • Start date Start date
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"?
 
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.
 
Back
Top