Report Names to Populate Form Labels

B

Brian

I have a form with report names on it. Next to each label
is a checkbox. If a user checks the box next to the
report name, he/she will receive that report as part of
their "Monthly reports" distribution.

My question...right now whenever I add a report or change
the name of a report, I must manually update this form.
Assuming I preface the report names with a "_" or "~",
does anyone know how I can programatically find all report
names starting with one of those characters and
automatically fill in the label captions?

By the way, I already have the form programmed to update a
print table which, if the checkbox is checked, takes the
associated label.caption and writes it to the table with
the requestors name. On the first of the month, I print
whatever reports are in the table. So it is critical that
the report names in the table (derived form the
label.caption) match the actual report names.

Plenty of Thanks to anyone that can help.
 
R

Rob Oldfield

Take a look at the MSysObjects table. (You'll have to use Tools, Options,
View to turn system objects on first) That will allow you to run a query to
pick all the objects where Type = -32764 to get a list of all reports, and
add another criterion if you only want the ones where the name begins with a
_ or whatever. (There are other ways to get a list of reports, this just
happens to be the one that I prefer.)

You could then run a make table query on that to create a table with the
report name, and add another boolean field with something like...

Dim adoConn As ADODB.Connection
Set adoConn = CurrentProject.Connection
adoConn.Execute "ALTER TABLE Reports ADD COLUMN ChosenReport YesNo;"
Set adoConn = Nothing

(Note... I can't figure out how to make the make table query create a
boolean column.... but there are various ways of getting around it.)

.....and then your form is based on that table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top