Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Recordset is returning empty

Status
Not open for further replies.

lujab2004

Programmer
Jul 21, 2008
2
US
The following code returns an empty recordset, but the mysql statement works fine on the server.

Form1.List1.Clear
OpenDB
recordset.ActiveConnection = conn
recordset.Source = "SELECT postingid, posting_jobid,
postingdate, postingshift, postingexpiration,
postingparttime, postingtemp From job_postings;"
recordset.Open
While recordset.EOF = False

'dummy vars for display in listbox only

dummyid = Left(recordset("postingid"), 15)
dummytitle = Left(recordset("jobtitle"), 25)


'display in listbox using dummyvars
Form1.List2.AddItem dummyid & Space(20 -
Len(dummyid)) & dummytitle & Space(25 -
Len(dummytitle))
recordset.MoveNext
Wend




OpenDB is a function that has been tested and works properly. conn is established as well as recordset. This code is copy and pasted from a working function. The only thing changed is the sql statement.
 
You might try
Code:
recordset.CursorLocation = adUseClient
Sometimes server side cursors have problems.

I also note that you have
Code:
dummytitle = Left(recordset("jobtitle"), 25)
but "jobtitle" is not the name of a field in your SQL.
 
thx about the "jobtitle", the problem is it never actually got to that point because recordset is empty.


recordset.CursorLocation=adUseClient is in OpenDB.
 
Try:

recordset.Open
recordset.MoveLast
recordset.MoveFirst
msgbox cstr(recordset.Recordcount)

and see what is returned
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top