[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 324
  • Last Modified:

MS Access - query a form question

I have a form that I wanted a quick way to navigate to a specific record via a 'ticket number'

I came up with this to avoid having to write a query and involve a new form but is there a way to use a query called by a button to retrieve the matching record(s) and make the form navigate to the record(s)? I know that would be much quicker than this method.

Thanks for the help

DoCmd.GoToRecord acDataForm, "TicketForm", acGoTo, 1

Do Until TicketNumberEntry = TicketNumberBox

DoCmd.GoToRecord , , acNext

Loop
0
rinkydink
Asked:
rinkydink
  • 2
2 Solutions
 
Rey Obrero (Capricorn1)Commented:


with me.recordsetclone
        .findfirst "[TicketNumberEntry]= " & TicketNumberBox
         if not .nomatch then
               me.bookmark=.bookmark
         else
             msgbox "record not found"
         end if
end with


if [TicketNumberEntry] is Text Data type
change this  line

      .findfirst "[TicketNumberEntry]= " & TicketNumberBox

with

      .findfirst "[TicketNumberEntry]= '" & TicketNumberBox &"'"



0
 
Rey Obrero (Capricorn1)Commented:
or you can filter the records in the form

me.filter="[TicketNumberEntry]= " & TicketNumberBox

me.filteron=true
0
 
GRayLCommented:
or you can use the OpenArgs property.  Press Alt+F11 to get to the VB Editor, in help enter OpenArgs
0
 
rinkydinkAuthor Commented:
Thanks guys!
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now