473,396 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting no records in Rst object

MLH
The SQL string returns 4 records if pasted into a QBE grid and run
manually. But in this DAO setting, I can't seem to get it to retrun
any records. When line #340 executes, error tells me No Current
Record. Ideas?

160 PString = "SELECT tblVehicleJobs.VehicleJobID,
tblVehicleJobs.ProcFee, tblVehicleJobs.VehicActive,
tblVehicleJobs.BilledOut FROM tblVehicleJobs "
180 PString = PString & "WHERE tblVehicleJobs.BilledOut=False AND
GetPortionPaid([VehicleJobID]>=[ProcFee]) AND
tblVehicleJobs.VehicActive=True"
240 Dim DB As Database, Rst As Recordset, QD As QueryDef
260 Set DB = CurrentDb
280 Set QD = DB.CreateQueryDef("", PString)
300 Set Rst = QD.OpenRecordset(dbOpenDynaset)
340 Rst.MoveFirst

Jan 23 '08 #1
4 1560
"MLH" <CR**@NorthState.netwrote in message
news:r1********************************@4ax.com...
The SQL string returns 4 records if pasted into a QBE grid and run
manually. But in this DAO setting, I can't seem to get it to retrun
any records. When line #340 executes, error tells me No Current
Record. Ideas?

160 PString = "SELECT tblVehicleJobs.VehicleJobID,
tblVehicleJobs.ProcFee, tblVehicleJobs.VehicActive,
tblVehicleJobs.BilledOut FROM tblVehicleJobs "
180 PString = PString & "WHERE tblVehicleJobs.BilledOut=False AND
GetPortionPaid([VehicleJobID]>=[ProcFee]) AND
tblVehicleJobs.VehicActive=True"
240 Dim DB As Database, Rst As Recordset, QD As QueryDef
260 Set DB = CurrentDb
280 Set QD = DB.CreateQueryDef("", PString)
300 Set Rst = QD.OpenRecordset(dbOpenDynaset)
340 Rst.MoveFirst
I would write the code as:

Dim rst as DAO.Recordset
Set rst = CurentDB.OpenRecordset(PString)
rst.MoveFirst

Fred Zuckerman
Jan 23 '08 #2
>
On Wed, 23 Jan 2008 07:50:04 -0800, "Fred Zuckerman"
<Zu********@sbcglobal.netwrote:

DAO.Recordset

>"MLH" <CR**@NorthState.netwrote in message
news:9i********************************@4ax.com.. .
Yep, I've seen the DAO.Recordset thing before. Why is
it better to declare it that way - as opposed to simply
declaring it AS RecordSet?

Oh, and BTW, the SQL string had a misplaced parentheses
that was causing my screw-up.
I'm a little clue-less about recordsets, I've learned the technique by
reading this group. I've NEVER seen the QueryDef technique that was in your
OP.
Fred
Jan 23 '08 #3
MLH wrote:
The SQL string returns 4 records if pasted into a QBE grid and run
manually. But in this DAO setting, I can't seem to get it to retrun
any records. When line #340 executes, error tells me No Current
Record. Ideas?

160 PString = "SELECT tblVehicleJobs.VehicleJobID,
tblVehicleJobs.ProcFee, tblVehicleJobs.VehicActive,
tblVehicleJobs.BilledOut FROM tblVehicleJobs "
180 PString = PString & "WHERE tblVehicleJobs.BilledOut=False AND
GetPortionPaid([VehicleJobID]>=[ProcFee]) AND
tblVehicleJobs.VehicActive=True"
240 Dim DB As Database, Rst As Recordset, QD As QueryDef
260 Set DB = CurrentDb
280 Set QD = DB.CreateQueryDef("", PString)
300 Set Rst = QD.OpenRecordset(dbOpenDynaset)
340 Rst.MoveFirst
Why not create a querydef at 280 (give it a name) and exit on 281 (exit
sub) and attempt to run the query?

North Shore
http://www.youtube.com/watch?v=BicBocJhYW8
Jan 23 '08 #4
MLH <CR**@NorthState.netwrote in news:r1nep3tggrnoov0kt2lg56obbceb4cp6dn@
4ax.com:
GetPortionPaid([VehicleJobID]>=[ProcFee])
Really?

and not

GetPortionPaid([VehicleJobID])>=[ProcFee]

?
Jan 23 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: C Kirby | last post by:
I'm running a DB using MSDE (2000) that is interfaced by 2 different ades running on PCs with Access 2000 Runtime. One of the ADEs is a package accounting system that is very solid and stable, the...
5
by: Thelma Lubkin | last post by:
I have a form/subform with the common one-to-many relationship. The form allows user to display records and move to other records via the selector, to add,delete, and edit them, with the related...
3
by: FaXiA | last post by:
Hi all, I'm working on a program that reads a structure from a file (1000 records). The file read part works great, but I'm hitting a roadblock on howto read the data from the pointer. I'm...
3
by: BrianDP | last post by:
I have a database with a split front end/back end. There is a key table in the back end called Catalog, and it is sort of a central key table for all sorts of things. It's a list of all the jobs...
1
by: sparks | last post by:
I have a form/table with an autoid it is linked to a table/form with and ID as a 1 to many. Under this form/table I need another table with many records for each on of the many in the previous...
1
by: Mike Lester | last post by:
I have a need for a stored procedure to return a recordset AND an output parameter that contains the count of records in the recordset. I can get either but not both. (ie. if there is a select...
2
by: srusskinyon | last post by:
I need some help getting unique records from our database! I work for a small non-profit homeless shelter. We keep track of guest information as well as what services we have offered for...
5
by: sujit1779 | last post by:
Hi, How can i get the address opened by a user in his internet explorer or any other browser. For eg if a user has opened site www.yahoo.com then, how can I get that programatically thanks
3
by: koti688 | last post by:
how to get the column names and the values of them in select statment. I have a packaze like this named ADB.pm package ADB; use DBI; @ISA = ('Exporter');
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.