Results 1 to 10 of 10
  1. #1
    wes028 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    9

    Stuck on Query

    I have a Form that is bound to a Query.



    With the Form Open in an Unbound text box. Type in a number. Then click a comand button will go to correct record in the table?

    How do you navigate to the correct record?

    Any Example would be great..
    Last edited by wes028; 01-14-2010 at 08:34 AM.

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    what you describe sounds like the vanilla function/intention of a combobox;

    when you add it to the form the wizard will step you thru it....

  3. #3
    wes028 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    9
    I've tried the combo box method. but i'm trying to keep the data shown tied to Query to display the one record. Then i can update the data needed to be updated in the table.

    Unless you know of a way that one can update a record of the table? Still searching for an option to get this done. Would be open to any idea's to get this done.

    Thanks

  4. #4
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    what we have here is a failure to communicate.

    to navigate records, in a form (in single mode and not continuous mode) one can of course simply use the embedded record selector at bottom

    or one can add a combobox/listbox and select any record that way

    one could construct a method to use an unbound text box; user enters record value - the underlying query of the form's record source uses the textbox as criteria - and you force the query to requery & the form to refresh... in this approach the user must know what value to enter as there is no choice offered as in a combo/list box method....

  5. #5
    wes028 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    9
    one could construct a method to use an unbound text box; user enters record value - the underlying query of the form's record source uses the textbox as criteria - and you force the query to requery & the form to refresh... in this approach the user must know what value to enter as there is no choice offered as in a combo/list box method....

    Yes... You got it. that's what i'm trying to do.. I cant get the criteria down to display the correct record.


    here is the Query. The PK is injAutoNumber
    Code:
     
    SELECT tblInjection.injAutoNumber, tblInjection.EmployeeNumber, tblInjection.ReJobNumber, tblInjection.ReOperationNumber, tblInjection.ReSubCode, tblInjection.ReSerialNumber, tblInjection.StartDateTime, tblInjection.Start, tblInjection.Scrap, tblInjection.Balance, tblInjection.EndDateTime
    FROM tblInjection;

    I've tried using a Dlookup command to get the record. But cant get that to work either.

    Code:
     
    Me.txtSer = DLookup("[ReSerialNumber]", "qrySerialFind", _
    "[ReSerialNumber] = '" & Forms!frmFinishRouter!txtSer & "'")

  6. #6
    jbarrum is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Apr 2009
    Location
    Houston, Tx
    Posts
    164
    Wes,

    I think you are making this too difficult. A list box or combo box will allow a user to select a record from a drop down and when the record is selected it will display the resutls of that record in your form

    Will this work for what you are trying to do?

  7. #7
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    to use a query criteria that is a value in a form's text box; just make a query using query design

    in the criteria of the appropriate field put:

    Forms!YourFormName.YourTextBoxName

  8. #8
    wes028 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    9
    Thanks NTC.. Let's try one more thing. How would you recall the query to run again. If the form is open. Or to get it to update to a command button.

    Would it be something like
    Me.ReQuery QueryName?

    Or is there something you have to do to refresh the form also?

    thanks,

  9. #9
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    docmd.requery "queryname"
    me.refresh

    actually try just the me.refresh and the form reopen may trigger the source query to rerun also....can't remember now....

  10. #10
    wes028 is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2010
    Posts
    9
    Thanks NTC for your help..

    Was able to find another way to get record.. thanks

    Code:
     Dim rs As Object
        
        Set rs = Me.Recordset.Clone
        
        rs.FindFirst "[ReSerialNumber] =   " & Me![txtSer] & ""
        If Not rs.EOF Then Me.Bookmark = rs.Bookmark

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Stuck on my Query by Form
    By Silver Rain 007 in forum Queries
    Replies: 0
    Last Post: 10-26-2009, 12:20 PM
  2. Stuck on Join Query
    By Pimped in forum Queries
    Replies: 1
    Last Post: 10-26-2009, 10:54 AM
  3. Sigh, having used Access in 5 years and stuck..
    By Access Denied in forum Access
    Replies: 3
    Last Post: 10-06-2009, 02:19 PM
  4. Newbie Here & Stuck
    By FOZILD in forum Access
    Replies: 5
    Last Post: 09-24-2009, 08:26 AM
  5. Newb stuck on Normalization
    By dave_wilford in forum Database Design
    Replies: 6
    Last Post: 05-19-2008, 02:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums