Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form is Main

Status
Not open for further replies.

krnsmartazz

Technical User
Dec 13, 2001
134
US
I want to create a form that will display all the reports currently in the database. I have 3 printers attached to the computer. I want to be able to assign the reports to a specific printer permantly. The later if needed you can change it. (password would be great)

The end result will be like Quickbooks Report.
 
You don't say what version of Access your are using.

Here is a way to fill a ListBox on a form with all the Reports in your Database using DAO. If you are using Access 2000/2002, you will need to enable Microsoft DAO 3.6 Library and alter the code slightly to get it to work.

Private Sub Form_Load()
Dim dbs As Database
Set dbs = CurrentDb
Dim ctr As Container
Dim rptList As String
Dim doc As Document

rptList = ""
Set ctr = dbs.Containers("Reports")

' Build the value list for Reports
For Each doc In ctr.Documents
  rptList = rptList & doc.Name & ";"
Next
' Load the List box
rptList = Left(rptList, Len(rptList) - 1) ' truncate the last semicolon
YourLstBoxName.RowSourceType = "Value List"
YourLstBoxName.RowSource = rptList
End Sub

(change "YourLstBoxName" to the actual name of your ListBox)

HTH
RDH Ricky Hicks
Birmingham, Alabama


 
thanks for your reply
I use Access 97
Instead of a listbox can I createa checkboxes or option button?
 
and is there a way I can make a command button that will allow me to assign the reports to certain printers?

Thanks for your reply
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top