Results 1 to 3 of 3

Thread: This might be easy . A DB Question

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258

    Question

    How are you today ? I'm thinking I have a problem that I can't fix involving a DB . If I querry the base for a name and it does't find it , the data base seems empty after the querry returns . If it finds the entry the only thing in the data control seems to be the found querry . Please read the Following code and see notes at the bottom . Thanks for having a look .





    This is what I'm Using
    Code:
    Public Function IsInDB(Nicktofind As String) As Boolean
       
       
       On Error GoTo OOPS
        Dim My_Query As String
    
        My_Query = "Nick" & " " & Cbo_Operator & " '" & Nicktofind & "'"
        Data1.RecordSource = "SELECT * FROM Users WHERE " & My_Query
     
        Data1.Refresh
    
        Data1.Recordset.MoveLast: Data1.Recordset.MoveFirst
        
        IsInDB = Not (Data1.Recordset.RecordCount = 0)
    
    Exit Function
    
    OOPS:
    MsgBox Error
    
    End Function
    In this line below
    does it load my database with only those items that where selected in the search ?
    If it does , how do I get it back to the whole database again ?
    Code:
    Data1.RecordSource = "SELECT * FROM Users WHERE " & My_Query
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Public Function IsInDB(Nicktofind As String) As Boolean
       
       
       On Error GoTo OOPS
        Dim My_Query As String
    
        My_Query = "Nick" & " " & Cbo_Operator & " '" & Nicktofind & "'"
        Data1.RecordSource = "SELECT * FROM Users WHERE " & My_Query
     
        Data1.Refresh
         'THIS LINE IS NOT NEEDED AND ON A BIG DB IT WOULD 
        'GIVE PROBLEMS IN TIME IE..1000 OR SO RECORDS.
        'Data1.Recordset.MoveLast: Data1.Recordset.MoveFirst
        
        IsInDB = Not (Data1.Recordset.RecordCount = 0)
    
    Exit Function
    
    OOPS:
    MsgBox Error
    
    End Function
    
    'yes you only select your querry
    ' to get all it's 
    dim sql
    sql = "select * from your tablename"
    data1.recordsource = sql
    data1.refresh
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    I think it worked . What's the Diffrence between
    Code:
     sql = "select * From Users"
    and
    Code:
     sql = "select * Users"
    ?
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width