Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / May 2007

Tip: Looking for answers? Try searching our database.

report variables from form list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cms - 22 May 2007 19:23 GMT
I have a table that lists shifts(shiftdetails) including their date/time.  I
have a listbox that is a query of those and shows the last 10 shifts.  

I would like the user to select one shift from the listbox, and hit a button
to generate a report using shiftid as a variable.  

I currently have the report working, along with the where condition.  I just
can not figure out how to pass the selected records shiftid value to it.

Private Sub previewrep_Click()
On Error GoTo Err_previewrep_Click

   Dim stDocName As String
   stDocName = "logs"
   DoCmd.OpenReport stDocName, acPreview, , "shiftid = 48"
Exit_previewrep_Click:
   Exit Sub
Err_previewrep_Click:
   MsgBox Err.Description
   Resume Exit_previewrep_Click
End Sub
cms - 22 May 2007 20:34 GMT
To answer my own question... I used the following code and changed the bound
column to the correct one with the shiftid.  All working now

   stDocName = "logs"
   Debug.Print Me!List0.ItemData(Me.List0.ItemsSelected(0))
   DoCmd.OpenReport stDocName, acPreview, , "shiftid=" & Me!List0.ItemData
(Me.List0.ItemsSelected(0))
     
I knew I would figure it out after posting, should have posted a few days ago
:)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.