I have a big problem with my VB project that I'm doing now...
first of all I'm doing a very basic database entery for a call center...to record the clients information that we speak with, so I made a form with text entery (mostly like name, phone numbers...etc)
my programme saves perfectly to the database file.
my problem is in searching. I used this code for searching :
[code]
Data1.RecordSource = "SELECT * FROM tblTransaction WHERE NomM = '*" & txtMNom.Text & "*' or TelMaison = '" & mtxtTelMaison.Text & "'"
Data1.Refresh
[/code]
the problem is that it does'nt work and I get nothing, all I get is that my form clears up :(
now what I realy would love to do is that I need to know the best way of displaying a list of results after a search has been performed.
As my application matches records to my search criteria, I would like to list these in a List Box that I have already created and called "lstSearch" and the results should be listed by date "txtDate" so that I can choose from the date and when I press on that date it would fill in my form.
is this possible to do or am I dreaming?
thanks in advance...
peace to all...
Replies (2)
1. Are you sure VB is opening up the connection? Maybe a popup box to display the connection string?
2. If you run the queries in the DB it's self, do you get the expected records returned? Maybe the query is wrong?
3. Are you sure it's not returning records? Maybe have it give a popup with the number of records returned. Maybe it's returning the records, the problem is getting them to display?
Dim ADOConn As ADODB.Connection
Dim ADORst As ADODB.Recordset
Dim strQuery As String
Set ADOConn = New ADODB.Connection
Set ADORst = New ADODB.Recordset
ADOConn.Open "Provider=sqloledb; Data Source=MyMachineName; Initial Catalog=pubs; User Id=MyUserName; Password=MyPassword"
MsgBox "Connection is now " & ADOConn.State
strQuery = "SELECT * FROM Jobs"
ADORst.Open strQuery, ADOConn, adOpenStatic, adLockReadOnly
MsgBox "Returned " & ADORst.RecordCount & " Records"
ADORst.Close
ADOConn.Close
Set ADORst = Nothing
Set ADOConn = Nothing
Ask A Data Miner - 75,000+ Members
Follow On Twitter
Request More Information
1. Are you sure VB is opening up the connection? Maybe a popup box to display the connection string?
2. If you run the queries in the DB it's self, do you get the expected records returned? Maybe the query is wrong?
3. Are you sure it's not returning records? Maybe have it give a popup with the number of records returned. Maybe it's returning the records, the problem is getting them to display?
Dim ADOConn As ADODB.Connection
Dim ADORst As ADODB.Recordset
Dim strQuery As String
Set ADOConn = New ADODB.Connection
Set ADORst = New ADODB.Recordset
ADOConn.Open "Provider=sqloledb; Data Source=MyMachineName; Initial Catalog=pubs; User Id=MyUserName; Password=MyPassword"
MsgBox "Connection is now " & ADOConn.State
strQuery = "SELECT * FROM Jobs"
ADORst.Open strQuery, ADOConn, adOpenStatic, adLockReadOnly
MsgBox "Returned " & ADORst.RecordCount & " Records"
ADORst.Close
ADOConn.Close
Set ADORst = Nothing
Set ADOConn = Nothing