Results 1 to 5 of 5
  1. #1
    myboii1984 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    3

    Unhappy recordsource - inquiry

    dear all,
    below script of my access project.
    im having a problem in my record source how will this run..
    pls help.. badly need the searching... thanks in advance. pls pls pls..

    error from the Form_frmCustomer_sub.RecordSource = LSQL

    Dim LSQL As String



    'Display all customers
    LSQL = "select * from Customers"

    Form_frmCustomer_sub.RecordSource = LSQL

    lblTitle.Caption = "Scanner Details: All records"

    msgbox "All Scanner are now displayed."

    End Sub


    Private Sub cmdSearch_Click()

    Dim LSQL As String
    Dim LSearchString As String

    If Len(txtsearchstring) = 0 Or IsNull(txtsearchstring) = True Then
    msgbox "You must enter a Scanner serial."

    Else

    LSearchString = txtsearchstring

    'Filter results based on search string
    LSQL = "select * from Customers"
    LSQL = LSQL & " where ScannerNo LIKE '*" & LSearchString & "*'"

    Form_frmCustomer_sub.RecordSource = LSQL


    lblTitle.Caption = "Scanner Details: Filtered by '" & LSearchString & "'"

    'Clear search string
    txtsearchstring = ""

    msgbox "Results have been filtered. All Scanner Names containing " & LSearchString & "."

    End If

    End Sub

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Here's a tip:
    Put a MsgBox right after this:
    Code:
    LSQL = "select * from Customers"
    LSQL = LSQL & " where ScannerNo LIKE '*" & LSearchString & "*'"
    . . . and see if it comes out looking exactly like this:
    Code:
    select * from Customers where ScannerNo LIKE "*LSearchString*"
    The query will work if it is passed to the Form with that syntax.
    Check this site out for a couple of good examples of how to get your SQL string working correctly.
    http://www.baldyweb.com/wherecondition.htm

    Hope this helps!

  3. #3
    myboii1984 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    3
    hi sir robeen,

    what msg box do i need to put on this?

    pls advise.

    thanks,

  4. #4
    myboii1984 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    3
    sir robben,

    during access run time when i try to search my scanner serial it shows error like this.


    Run time error '424':
    object required.

    then when i hit debug it highlighted the code below.

    Form_frmCustomer_sub.RecordSource = LSQL

    what should i do to work on this code? actually
    i just copy it somewhere on this site but i cant fine to work on my code.

    thanks in advance.

    regards,

  5. #5
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    1. I was suggesting that you put in a message box statement like this:
    Code:
    Msgbox "LSQL = " & LSQL
    2. Now that I look a little closer, I wonder if there is a problem with this part of your code:
    Code:
    Form_frmCustomer_sub.RecordSource = LSQL 
    You might Google 'Forms Object'.

    Try this:
    Code:
    Forms!Form_frmCustomer_sub.RecordSource = LSQL
    OR - if that line of code is running FROM the form:
    Code:
    Me.Form_frmCustomer_sub.RecordSource = LSQL
    Let me know how it goes.

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

Similar Threads

  1. Layout Inquiry
    By allstar45 in forum Reports
    Replies: 2
    Last Post: 03-15-2012, 11:44 AM
  2. Export Recordsource
    By Paul H in forum Reports
    Replies: 2
    Last Post: 10-27-2011, 01:47 PM
  3. Inquiry form updates the current record
    By mazzanrol in forum Forms
    Replies: 4
    Last Post: 04-08-2011, 08:35 AM
  4. RecordSource help
    By mann2x in forum Access
    Replies: 3
    Last Post: 10-05-2010, 06:44 PM
  5. Query Optimization Inquiry
    By Nobody in forum Queries
    Replies: 1
    Last Post: 07-29-2010, 08:53 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