Solved

MS Access - query a form question

Posted on 2011-02-15
4
272 Views
Last Modified: 2012-05-11
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
Comment
Question by:rinkydink
  • 2
4 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 400 total points
ID: 34903199


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
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 34903206
or you can filter the records in the form

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

me.filteron=true
0
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 100 total points
ID: 34912524
or you can use the OpenArgs property.  Press Alt+F11 to get to the VB Editor, in help enter OpenArgs
0
 
LVL 1

Author Closing Comment

by:rinkydink
ID: 34939913
Thanks guys!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now