Solved

MS Access - query a form question

Posted on 2011-02-15
4
299 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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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 120

Expert Comment

by:Rey Obrero (Capricorn1)
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

860 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