UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Recordsource problems    
 
   
warneri
post May 30 2005, 06:02 AM
Post #1

New Member
Posts: 18



Hi,

I am attempting to use the following code:

Set recSource = CurrentDb().OpenRecordset("select * from qryCut_Over_Details where " & _
"[loop] = '" & strLoop & "'")

The problem is that it only returns a recordsource with a recordcount = 1 even tough if I build a query with the same SQL string I get a list of 50 odd entries. Why would the VB code only return a single entry?

Thanks
Roger Warne
Go to the top of the page
 
+
warneri
post May 30 2005, 06:11 AM
Post #2

New Member
Posts: 18



I added a ORDER BY [loop] and it works!

Thanks all
Go to the top of the page
 
+
kuifjexx
post May 30 2005, 06:12 AM
Post #3

UtterAccess VIP
Posts: 7,232
From: Belgium



Best is to do this in steps

Dim Db as dao.database
Dim rs as dao.recordsource

SQLString = "select * from qryCut_Over_Details where " & "[loop] = '" & strLoop & "'"
Debug.print SQLString

Set db= currentdb()
Set rs = db.openrecordset(SQLString)

By using the debug.print line, you can see the contents of the SQL-string in the immediate window
I use also single quotes around the textvalue

HTH

Greetz from Belgium (IMG:http://www.utteraccess.com/forum/style_emoticons/default/compute.gif)

Luc aka Kuifjexx
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 08:01 AM