How do I enter a table I want to query in access. Same report fo.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i HAVE A DATABASE CONSISTING OF 50 TABLES. EACH TABLE CONTAINS NAMES AND
OTHER INFORMATION SUCH AS DOB, POLITICAL PARTY AND OCCUPATION.

EACH REPORT MUST BE KEPT SEPARATE. CANNOT COMBINE ANY OF THEM.

I'VE GONE CRAZY TRYING TO FIND A WAY OF RUNNING THE REPORT I WANT BY JUST
ENTERING THE COMMUNITY NAME.

I'M TRYING TO STAY AWAY FROM VB.

ANY SOLUTIONS OUT THERE?
 
In your query with the table you plan to use, under the criteria section for
the Community name type the following.
Like [Enter Community Name] & "*" Then use the query to create your report.
Then when you want to run a report the user or you will be prompted for the
Community Name. Whatever matches to what you typed in, that data will be
returned. Also note that because you have used the phrase Like and placed &
"*", it will allow for partial typing of the communty name. It will also
allow you to get all the data if you later to choose to print one big report
with all Community names. Just press enter without entering any data into
the prompt.

Hope this is what you are looking for.
 
As far as I know, there is no way to do this without using VBA.

If just one table is involved in each query, you could use some fairly simple
vba to build the SQL string as long as each table has the same field names.
You can then assign that built string as the source for your report.

Also, are you talking about using different tables for the same report or having
a multitude of reports on each table?

Create a form with a button (btnRunReport) and a control for entering the
tablename (tableVariable). You can use a combobox, a listbox, or text control.

Private Sub btnRunReport_Click()

Dim strSQL as String

strSQL = "SELECT * FROM [" & Me.TableVariable &"]"

DoCmd.OpenReport "NameOfReport",acViewPreview,strSQL

End Sub
 
Back
Top