When I am programming, I want to view recordsets that I've created on
the fly. I open them with something like:
set tTable = CurrentDb.OpenRecordSet("select fRecNo,fDesc from
tDrivers")
If I executed this line, and interupted the program, what is the
fastest way to view the resulting recordset to make sure things look
all right?
David 6 3490
David wrote: When I am programming, I want to view recordsets that I've created on the fly. I open them with something like:
set tTable = CurrentDb.OpenRecordSet("select fRecNo,fDesc from tDrivers")
If I executed this line, and interupted the program, what is the fastest way to view the resulting recordset to make sure things look all right?
dumprs ttable
Sub dumpRs(rs As Recordset)
Dim cBook As String
If rs.RecordCount = 0 Then
Debug.Print "empty."
Else
cBook = rs.Bookmark
rs.MoveFirst
dumpRecord rs, True
Do Until rs.EOF
dumpRecord rs
rs.MoveNext
Loop
Debug.Print
rs.Bookmark = cBook
End If
End Sub
Sub dumpRecord(rs As Recordset, Optional fieldnames = False)
Dim fd As Field
For Each fd In rs.Fields
If fd.OrdinalPosition > 0 Then Debug.Print ", ";
If fieldnames Then
Debug.Print fd.Name;
Else
Debug.Print fd.Value;
End If
Next
Debug.Print
End Sub
--
Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
David wrote: When I am programming, I want to view recordsets that I've created on the fly. I open them with something like:
set tTable = CurrentDb.OpenRecordSet("select fRecNo,fDesc from tDrivers")
If I executed this line, and interupted the program, what is the fastest way to view the resulting recordset to make sure things look all right?
Define the sql with a string variable and do a debug.print on the string
before executing the above. Cut the statement from the debug window,
paste into an SQL view of a query and voila!
Sounds involved, but I do this all the time and it works fine.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "What's UP, Dittoooooo?" - Ditto
David wrote: When I am programming, I want to view recordsets that I've created on the fly. I open them with something like:
set tTable = CurrentDb.OpenRecordSet("select fRecNo,fDesc from tDrivers")
If I executed this line, and interupted the program, what is the fastest way to view the resulting recordset to make sure things look all right?
David
'here is a way to pass a SQL string to a proc to display the results.
'the ShowResults sub calls DisplayResults and presents the data in
datasheet view. If JunkQuery exists, it gets deleted. A new query is
then created called JunkQuery. The result records are displayed.
Sub ShowResults()
DisplayResults "Select * From Table"
End Sub
Sub DisplayResults(strSQL As String)
Dim dbs As Database
Dim qdfNew As QueryDef
Set dbs = CurrentDb
On Error Resume Next
DoCmd.DeleteObject acQuery, "JunkQuery"
Set qdfNew = dbs.CreateQueryDef("JunkQuery", strSQL)
DoCmd.OpenQuery "JunkQuery"
End Sub
Tim Marshall wrote: David wrote:
When I am programming, I want to view recordsets that I've created on the fly. I open them with something like:
set tTable = CurrentDb.OpenRecordSet("select fRecNo,fDesc from tDrivers")
If I executed this line, and interupted the program, what is the fastest way to view the resulting recordset to make sure things look all right?
Define the sql with a string variable and do a debug.print on the string before executing the above. Cut the statement from the debug window, paste into an SQL view of a query and voila!
Sounds involved, but I do this all the time and it works fine.
I do that all the time too, and I find it so boring that I wrote a small
helper routine:
Sub Q(Optional cSQL = "")
Dim qd As QueryDef
On Error Resume Next
DoCmd.Close acQuery, "_temp", acSaveNo
Set qd = CurrentDb.QueryDefs("_temp")
qd.SQL = cSQL
DoCmd.OpenQuery qd.Name, acViewDesign
End Sub
I have a query called _temp for this purpose. Now, from the debug
window, I can type
q <variable>
and I will get the query in design view. More Voila!
--
Bas Cost Budde, Holland http://www.heuveltop.nl/BasCB/msac_index.html
I prefer human mail above automated so in my address
replace the queue with a tea
Bas Cost Budde wrote: Aha, you too ;-)
Great minds think alike. :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: David P. Jessup |
last post by:
Well I have seen this posted before and haven't seen much in response.
My application has to browse through various folders and find file names.
Sometimes these folders can have thousands of...
|
by: laurenq uantrell |
last post by:
I am trying to determine which of three stored procedure designs are
fastest in the Query Analyzer:
One query is a straight SELECT query with all desired rows and a dozen
(tblName.RowName =...
|
by: John |
last post by:
Just a general question...
I'm currently using a combobox that when updated, opens a form with
its recordset based on a query using the combo box value as the
criteria.
I'm I correct in...
|
by: Bob Hynes |
last post by:
Hi All,
In Access97 I have a linked table(jet backend on a server) which
contains 217,432 records today, I have a form on which users enter a
policy number which they want to find and have...
|
by: windandwaves |
last post by:
Hi Gurus
When I have a query in which I use a small function, e.g.:
SELECT A03_FILES.ID, A03_FILES.D, hasvt() AS hsvVT
FROM A03_FILES;
where HasVT is defined below:
--------------------
| |
by: adm |
last post by:
There are a few ways to go about this, but what is the fastest when
called from VBA? This if for an ADP with a SQL Server back-end.
|
by: Julie |
last post by:
What is the *fastest* way in .NET to search large on-disk text files (100+ MB)
for a given string.
The files are unindexed and unsorted, and for the purposes of my immediate
requirements, can't...
|
by: Eric Twietmeyer |
last post by:
Hi,
Does anyone know why starting with VS.NET 2002 (and same with 2003) it is no
longer possible to browse to a directory that has "ept" as part of the path?
It worked fine in Vc 6.x. My...
|
by: Vjay77 |
last post by:
Hi,
I haven't posted any problem in quite a while now, but I came to the
point that I really need to ask for help.
I need to create an application which will search through .txt log
file and...
|
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,...
|
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...
| |
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |