Professional Documents
Culture Documents
User Name:
User Name
Password:
Log in
Remember me
Dev Articles Community Forums > Databases > Microsoft Access Development
Best way to display VBA query results?
Discuss Best way to display VBA query results? in the Microsoft Access Development forum on Dev Articles.
Best way to display VBA query results? Microsoft Access Development forum to discuss problems and solutions with this popular DBMS. Use
Access to build and modify database tables, or full-featured applications.
Previous Thread | Next Thread Thread Tools Search this Thread Display Modes
DevArticlesCommunityForumsSponsor:
December22nd,2004,03:08AM #1
What is the best way to display the results from a VBA query in Access (97)?
User fires of query with a button click. I just want to open up a table view of the results but since I am new to
Access dev I am not sure how to do this.
Code is:
Code:
productName = "ADSL"
strSql = "SELECT [Information].* From [Information] WHERE [Information].Product = " & Chr(34) & productName &
Many thanks
December22nd,2004,09:36AM #2
The quickest way would be to save the sql as a query, then open that in code as follows:
docmd.openquery "QueryName"
December22nd,2004,09:51AM #3
To view the record set you need to create a temporary query to view and then delete the temp query when
finished. Use the following code to create a temporary query that is named tmpProductInfo
productName = "ADSL"
strSql = "SELECT [Information].* From [Information] WHERE [Information].Product = " & Chr(34) &
productName & Chr(34) & ";"
With dbs
Set qdf = .CreateQueryDef("tmpProductInfo", strSql)
DoCmd.OpenQuery "tmpProductInfo"
.QueryDefs.Delete "tmpProductInfo"
End With
dbs.Close
qdf.Close
lwells
December22nd,2004,10:23AM #4
December2nd,2008,08:16AM #5
tekmeat Join Date: Dec 2008
Posts: 1
Registered User
Time spent in forums: 13 m 5 sec
Reputation Power: 0
Works great
Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > Best way
to display VBA query results?
Posting Rules
vB code is On
Smilies are On View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
[IMG] code is On Forum Jump
HTML code is Off Microsoft Access Development Go
2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap