Results 1 to 3 of 3
  1. #1
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26

    Running query instead of showallrecords command

    In a stock form i have set apart a text box with row source connected to a table/query to display all the 'code numbers' available. I used the following code to display a search:



    Code:
    Private Sub cmdsearch_Click()
    Dim reference As String
        Dim strSearch As String
    
        If IsNull(Me![txtsearch]) Or (Me![txtsearch]) = "" Then
            MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!"
            Me![txtsearch].SetFocus
        Exit Sub
    End If
        
        DoCmd.ShowAllRecords
        DoCmd.GoToControl ("CodeNumber")
        DoCmd.FindRecord Me!txtsearch
            
        CodeNumber.SetFocus
        reference = CodeNumber.Text
        txtsearch.SetFocus
        strSearch = txtsearch.Text
    
        If reference = strSearch Then
            MsgBox "PRODUCT FOUND!: " & strSearch, , "Successfull!"
            CodeNumber.SetFocus
            txtsearch = ""
            
            Else
              MsgBox "PRODUCT DOESN'T EXIST!: " & strSearch & " -  Try Again.", _
                , "Invalid Search Criterion!"
                txtsearch.SetFocus
        End If
    End Sub
    I need to replace the bold code so instead calling "showallrecords", the values written in "txtsearch" field, run through a query and then loaded the details in stock form. Any ideas? Hope i explained myself right

    Thanks

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529

  3. #3
    spleewars is offline Novice
    Windows XP Access 2002
    Join Date
    Feb 2012
    Posts
    26
    Okiezzz, solution to the problem was to create a new query inside the same form and filter the code number.

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

Similar Threads

  1. Query with a running sum
    By is49460 in forum Queries
    Replies: 3
    Last Post: 09-07-2013, 11:11 PM
  2. Running totaling with a query
    By tttccc in forum Queries
    Replies: 1
    Last Post: 03-28-2012, 09:37 AM
  3. Running a shell command from a stored procedure.
    By sstrauss87 in forum SQL Server
    Replies: 3
    Last Post: 03-01-2012, 04:39 PM
  4. Running a query
    By scarlettera in forum Queries
    Replies: 3
    Last Post: 04-04-2011, 01:59 PM
  5. Replies: 13
    Last Post: 02-23-2011, 08:38 AM

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