-
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
-
<?>
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
-
I think it worked . What's the Diffrence between
Code:
sql = "select * From Users"
and
Code:
sql = "select * Users"
?