-
WSbushaw
AskWoody LoungerA while back I wanted to do exactly what you’re describing. I poked around in the Adobe documentation describing their Object Model (hoping to find something for their bookmarks “controllable” from Access via VBA automation). No such luck. As I remember, the documentation explicitly stated that Bookmarks were not accessible via this route. Maybe there’s some other “back-door” solution to your problem. I’ll be watching here to see what materializes!
-
WSbushaw
AskWoody LoungerYes, I went in with programming experience in other languages so I may have had a head start. Nonetheless, I remember the book as not leaving too much to prior experience. Your best bet is to look at the books (as you plan to do), but I suggest you look closely at how the book progresses from chapter to chapter (avoid the “reference” format and look for the “tutorial” format). See if Chapter 1 is comprehensible or all Greek. If Greek, then maybe a step back to a beginning book on Visual Basic might be in order (forget the “Access” and “for Applications” piece until you get familiar with the fundamentals). There are a lot more of just Visual Basic books out there, so it’s more likely there’s one that fits your experience level, is well-organized, easy-to-follow, and all that good stuff.
Good luck.
-
WSbushaw
AskWoody LoungerYou’re right, Claus. As long as the form has a control (combo box or list box) where the class is selected (and ClassID is the bound value), as is the case with your sample db. (Randall, it seems like you need to have this class-selection control on your form, right?)
I was giving Randall a possible patch to his existing code.
-
WSbushaw
AskWoody LoungerRandall,
I haven’t checked out Claus’ solution, but I think you’re pretty close with yours.
As Claus points out, you are assigning your SQL string to rst!ClassID. What you want to do is evaluate the SQL query and assign the result of the query to rst!ClassID. To do this you can used CreateQueryDef():
rst!ClassID = CurrentDb().CreateQueryDef(“”,””).OpenRecordset!ClassID
Alternatively, you could use the DLookup function:
rst!ClassID = DLookup(“ClassID”, “qryClasses”, “ClassDate = ‘” & Me!lstClassDate & “‘ AND ClassName = ‘” & Me!cboClassName & “‘”)
The three arguments of DLookup() are the SELECT, FROM, and WHERE clauses (without the keywords and closing semicolon), respectively.
Hope this helps.
-
WSbushaw
AskWoody LoungerNeil,
Glad you got it figured out. Sorry I didn’t check back sooner to see if you needed more help. Obviously there’s lots of help here in the Lounge, ready and waiting! I knew I had left lots of gaps in my suggestion — sometimes you learn more by figuring things out rather than following a recipe, right? Frustrating at times, sure, but more satisfying in the end.
You might try Rory’s suggestion for “populating” your list box. Rather clever, I think. It keeps the list up to date as you add or remove reports or change report names, and it doesn’t require a separate table. I was trying to figure out a way of doing that but was unsuccessful. If you want to exclude certain reports (e.g., subreports as Rory mentions or other reports used for other purposes), just name your reports in a clever way. For example, begin the names of the ones you want to include with something like “List”, then add the following filter to Rory’s query:
SELECT Name from MSysObjects WHERE Type = -32764 AND Left(Name,4)=”List”;
Good luck.
-
WSbushaw
AskWoody LoungerHere’s a basic outline of one approach (reply back if you need more detail):
1. Create a table which includes your report names (this table could be populated by inspecting the CurrentDb().Containers(“Forms”).Documents collection — if you’re familiar with VBA and navigating the object model — otherwise, just fill in the table by hand).
2. Create a form that uses this table as its Record Source. Include a text control that references the table’s report name field.
3. On this form create a “Preview” button. As its OnClick event, specify the following command:
DoCmd.OpenReport Me!txtReportName, acViewPreview
(txtReportName is the Name for the text control on the form that displays the selected report name).
4. Create a similar “Print” button with a simiar OnClick event, but specify acViewNormal instead of acViewPreview
I think something like that would get you what you want. I’ve left out the gory details. If you need them, holler.
-
WSbushaw
AskWoody LoungerI, too, was using Access 97 when I determined that I needed to learn VBA. I used “Microsoft Access 97 / Visual Basic Step-by-Step” (http://www.microsoft.com/MSPress/books/338.asp) which I found very nicely organized and targeted towards the VBA novice (particularly if you’re already familiar with Access w/o VBA). I’d suggest forcing yourself to work all the way through it from start to finish — as the title implies, it’s designed that way; as a hands-on (in front of your computer) tutorial. It does have some mistakes, but none of them are too frustrating. (As my first VBA “project” I actually created a database to log the book’s errata and sent it in to Microsoft Press — I’ll post it here if anyone’s interested.)
The author has published an Access 2000 edition (http://www.microsoft.com/mspress/books/2533.asp), but I haven’t looked at it.
There may be better alternatives out there, but this one worked very nicely for me.
-
WSbushaw
AskWoody LoungerHere
-
WSbushaw
AskWoody LoungerPeter,
If you’re using a macro for the On Click event for your Preview Report button on your form, then you just need to add a second action to that macro (after your OpenReport action). Select RunCommand as the action and Zoom100% as the command (it’s in the command drop-down list).
Alternatively, if you’re using VBA code (by selecting “Event Procedure”) as the On Click event handler, then include the following code for your cmdButton_Click() procedure:
DoCmd.OpenReport “ReportName”, acViewPreview
DoCmd.RunCommand acCmdZoom100Hope this helps. Holler if you need more detail.
-
WSbushaw
AskWoody LoungerInclude the following line after your DoCmd.OpenReport statement:
DoCmd.RunCommand acCmdZoom100
Note that this will not work if you try to include it in your On Open event for the report. Docmd.Maximize does work either place… go figure. -
WSbushaw
AskWoody LoungerOne option is to open the table you just created in Design View, Insert a new field, name it PrimaryID (or whatever), with an AutoNumber data type. Then right click on this row of the design grid and select “Primary Key”.
If your “Customers” table has a AutoNumber PrimaryID field already, include that in your Make Table query, too. Then all you’ll have to do is identify it as the Primary Key in the new table (as described above).
I don’t know of identifying the Primary Key as part of the Make Table Query. Anyone?
-
WSbushaw
AskWoody LoungerJanuary 13, 2002 at 5:45 pm in reply to: Need guidance autolinking tables (Office 97 SR2 win98) #563489Yes, when you run MSQuery from Excel (Tools…Get External Data) and the Wizard asks for the source database and you select your Access mdb file (the one with the UNION query), that query will appear in the list of “tables” you can retrieve.
When you use Tools…Get External Data to run MSQuery and import the data the first time, Excel creates a QueryTable object that maintains the linkage to the Access database, so that when your Access data changes, you just need to select Data…Refresh Data to update your Excel table.
You can also set a refresh interval for the QueryTable object so that the refresh occurs automatically and periodically. Select Data…Get External Data…Data Range Properties for the various options (these menus are from Excel 2000; Excel 97 may be slightly different?). Of course, you may already be familiar with these options since you’ve queried from Excel before…
-
WSbushaw
AskWoody LoungerJanuary 11, 2002 at 10:24 pm in reply to: Need guidance autolinking tables (Office 97 SR2 win98) #563249Here’s a possibility to get you started:
In your yyProj.mdb database (which has link tables to the table(s) of interest in each of your mmmyyProj.mdb databases, right?) create a UNION query that “glues” all these tables together. The syntax would be something like:
SELECT * FROM [jan02Proj]
UNION SELECT * FROM [feb02Proj]
UNION …
…
UNION SELECT * FROM [dec02Proj];where jan02Proj, etc. are the linked table names (not necessarily the mdb file names.
As far as I know, UNION queries can’t be created using the design grid; you have to type the SQL code directly into the SQL window.
The result of this query can be exported to Excel using Office Links or via VBA code.
Yes you can do all of this from Excel VBA. I’ll follow up with some guidance for this in a later post (don’t have time now), if somebody doesn’t beat me to it.
By the way, I had some “flakeness” problems with Excel 97 – Access 97 automation (e.g., running Access from Excel and vise versa). Generally it worked okay but occasionally I got “automation errors” seemingly out of the blue. Just a forewarning. Office 2000 seems to behave much better in this regard.
Good luck.
-
WSbushaw
AskWoody LoungerJanuary 9, 2002 at 6:14 pm in reply to: Portrait Header / Landcape Body (Word 2000/9.0.4402 SR-1) #562584Thank you all for your quick feeback!
It appears that “the solution” is placing a text box in the landscape page’s header, sizing it to look like a portrait header, and rotating its text 90
-
WSbushaw
AskWoody LoungerThe date data type is a 64-bit floating point number (same as the ‘double’ type). When you subtract two dates/times resulting in a negative time you get a negative time. For example, try this in the VBA debug window:
?Cdbl(#10/16/01 8:00# – #10/17/01 8:00#)
You get a result of -1 (i.e., 1 day).Retaining this ‘double’ data type (using either the ‘Double’ or the ‘Date’ data type) will let you deal with the math without all the text conversions. When you get to the point you want to display the value, use something like:
iif(dteGain<0,"-","")&format(abs(dteGain),"hh:mm")
(I’m not sure how you want to display the gain — the above will have problems if the abs(dteGain) > 1; i.e., > 24 hours.)Hope this helps a little.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Who knows what?
by
Will Fastie
34 minutes ago -
My top ten underappreciated features in Office
by
Peter Deegan
1 hour, 52 minutes ago -
WAU Manager — It’s your computer, you are in charge!
by
Deanna McElveen
4 hours, 38 minutes ago -
Misbehaving devices
by
Susan Bradley
26 minutes ago -
.NET 8.0 Desktop Runtime (v8.0.16) – Windows x86 Installer
by
WSmeyerbos
22 hours, 16 minutes ago -
Neowin poll : What do you plan to do on Windows 10 EOS
by
Alex5723
18 hours ago -
May 31, 2025—KB5062170 (OS Builds 22621.5415 and 22631.5415 Out-of-band
by
Alex5723
20 hours, 50 minutes ago -
Discover the Best AI Tools for Everything
by
Alex5723
20 hours, 59 minutes ago -
Edge Seems To Be Gaining Weight
by
bbearren
11 hours, 8 minutes ago -
Rufus is available from the MSFT Store
by
PL1
19 hours, 11 minutes ago -
Microsoft : Ending USB-C® Port Confusion
by
Alex5723
1 day, 22 hours ago -
KB5061768 update for Intel vPro processor
by
drmark
1 day, 4 hours ago -
Outlook 365 classic has exhausted all shared resources
by
drmark
9 minutes ago -
My Simple Word 2010 Macro Is Not Working
by
mbennett555
1 day, 17 hours ago -
Office gets current release
by
Susan Bradley
1 day, 20 hours ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
3 days, 10 hours ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
2 days, 19 hours ago -
Stop the OneDrive defaults
by
CWBillow
3 days, 11 hours ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
3 days, 21 hours ago -
X Suspends Encrypted DMs
by
Alex5723
3 days, 23 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
3 days, 23 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
4 days ago -
OpenAI model sabotages shutdown code
by
Cybertooth
4 days ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
3 days, 13 hours ago -
Enabling Secureboot
by
ITguy
3 days, 20 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
4 days, 8 hours ago -
No more rounded corners??
by
CWBillow
4 days, 4 hours ago -
Android 15 and IPV6
by
Win7and10
3 days, 18 hours ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
4 days, 21 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
4 days, 23 hours ago
Recent blog posts
Key Links
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.