Results 1 to 5 of 5
  1. #1
    bahalzamon is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2015
    Location
    Phoenix, AZ
    Posts
    23

    Form in a Form Query from Textbox

    Hello Geniuses!



    I have a form within a navigation form and am attempting to pull the information within a text box to re-query the information for a listbox.
    The part I am having issue with is:
    Code:
    WHERE [queryStudentStatus].[SSID] = Forms!formNavigation!formStudentHistory.Form!Student;
    When I run the exact same code from within "formStudentHistory" it works perfectly when I change it to:
    Code:
    WHERE [queryStudentStatus].[SSID] = Forms!formStudentHistory!Student;
    I retrieved the info on how to do the code from here. But I must be doing something wrong and i'm sure its going to be something simple I am missing. =)

    The whole button code
    Code:
    Private Sub btnRefresh_Click()
        If IsNull(Me.Student) Then
            List28.RowSource = "SELECT [queryStudentStatus].[SSID], [queryStudentStatus].[firstName], [queryStudentStatus].[lastName], [queryStudentStatus].[Barcode], [queryStudentStatus].[Manufacturer], format([queryStudentStatus].[checkOut],'Short Date'), format([queryStudentStatus].[checkIn],'Short Date') FROM [queryStudentStatus];"
            List28.Requery
        Else
            List28.RowSource = "SELECT [queryStudentStatus].[SSID], [queryStudentStatus].[firstName], [queryStudentStatus].[lastName], [queryStudentStatus].[Barcode], [queryStudentStatus].[Manufacturer], format([queryStudentStatus].[checkOut],'Short Date'), format([queryStudentStatus].[checkIn],'Short Date') FROM [queryStudentStatus] WHERE [queryStudentStatus].[SSID] = Forms!formNavigation!formStudentHistory.Form!Student;"
            List28.Requery
        End If
    End Sub
    Please and assistance would be greatly appreciated, also if you need any additional info from me please let me know. =D

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I do not use the navigation form, so I have no experience with it. But I did find a site that might help:

    Navigation Control - Subforms
    http://bytes.com/topic/access/answer...ntrol-subforms

  3. #3
    bahalzamon is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2015
    Location
    Phoenix, AZ
    Posts
    23
    Thanks ssanfu,

    It didnt get me the answer directly, but it got me looking in the correct location and by doing a bit of winging it, I got it to work. =)
    Thanks for the help.

    This is what worked for me:
    Code:
    WHERE [queryStudentStatus].[SSID] = [Forms]![formNavigation]![NavigationSubform].[Form]![Student]
    My problem was with it saying [NavigationSubform] I thought it was refering to the form within the navigation form of [formStudentHistory] in my case, but [NavigationSubform] is the default name of the object when selecting it in design view. That is how I got to the correct answer. =)


    The Breakdown how I saw it
    Code = [Forms]![formNavigation]![NavigationSubform].[Form]![Student]
    [Forms] = constant as pointing to the forms section of your Access file
    [formNavigation] = the name of your navigation form, for me it was formNavigation
    [NavigationSubform] = the name of the object within your navigation for, found within the properties > Other > Name, this navigates it to the correct location
    [Form] = I think saying you are looking at a form to access the proper objects within it
    [Student] = the object you are attempting to access, for me its a text box used to requery the data within a list box

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Excellent..

    IMO, the navigation form is too restrictive, so I create my own navigational forms. But I'm glad it worked out for you.

  5. #5
    bahalzamon is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2015
    Location
    Phoenix, AZ
    Posts
    23
    Well, this is my first use of Access, I would love to do some more cool stuff, but this is at about the extent of what I know/dont know...lol
    Thanks again for the help. =D

    -bahalzamon

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

Similar Threads

  1. Replies: 5
    Last Post: 04-30-2015, 01:50 AM
  2. Query with parameter from Form Textbox
    By Juan4412 in forum Queries
    Replies: 1
    Last Post: 07-10-2013, 02:33 PM
  3. Enter query result in a form textbox
    By Damo10 in forum Forms
    Replies: 2
    Last Post: 06-30-2013, 06:43 PM
  4. Replies: 1
    Last Post: 10-28-2011, 02:46 PM
  5. Replies: 1
    Last Post: 02-04-2010, 01:15 PM

Tags for this Thread

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