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 / April 2007

Tip: Looking for answers? Try searching our database.

help with list

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Will G - 06 Apr 2007 23:36 GMT
Hello, i am really new with access and i like to make a few adjustments to
my selection on a list. right at this moment, i have a multiselection list
and what it does with the code bellow is when i select a OrderNo, and print
result it will prints all OrderNos. to be more clear i will give an
example..........in the list row i have OrderNo, RequiredDate, CustomerID,
Comment, ProductID, Desc....and right now i have a criteria of OrderNo...

OrderNo | RequiredDate | CustomerID | Comment | ProductID| Desc
4001           4/6/07             MSC                ANY          A002      
 ANY
4001           4/5/07             VSC                 ANY1        A003      
 ANY
4001           4/5/07             VCC                ANY           A003      
 ANY
4444           4/6/07             MSC                ANY           A004      
 ANY

right now, if i select the first 4001 and 4444, i get all 4001s and 4444son
my report. i like to get just what i selected. do anyone know how to do
this....my code look like this.  

   strDoc = "rptProduction"
   strLabel = "rptProductionLabel"
   'Loop through the ItemsSelected in the list box.
     If Me.sched.ItemsSelected.Count = 0 Then
   Beep
   MsgBox "no item selected ", 48
   Exit Sub
   End If
   
   With Me.sched
       For Each varItem In .ItemsSelected
           If Not IsNull(varItem) Then
               'Build up the filter from the bound column (hidden).
               strWhere = strWhere & strDelim & .ItemData(varItem) &
strDelim & ","
               'Build up the description from the text in the visible
column. See note 2.
               'strDescrip = strDescrip & """" & .Column(1, varItem) & """, "
           End If
       Next
   End With
   
     lngLen = Len(strWhere) - 1
   If lngLen > 0 Then
       strWhere = "[OrderNo] IN (" & Left$(strWhere, lngLen) & ")"
       
       lngLen = Len(strDescrip) - 4
       If lngLen > 0 Then
           'strDescrip = "Production Required: " & Left$(strDescrip, lngLen)
       End If
   End If
   
    If CurrentProject.AllReports(strDoc).IsLoaded Then
       DoCmd.close acReport, strDoc
   End If
   
       DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere,
OpenArgs:=strDescrip
Signature

need help

hmadyson - 08 Apr 2007 01:40 GMT
It looks to me like your primary key is not just Orderno, but also required
date. In your strWhere you will need to give both. You can do this by looking
not only at the bound column in the list, but also the next column. So it
needs to end up showing (OrderNo = 4444 and RequiredDate=#4/6/07#) make sure
that you include the #s when putting a date in your where.

Please let me know if I can provide any more assistance.

>  Hello, i am really new with access and i like to make a few adjustments to
> my selection on a list. right at this moment, i have a multiselection list
[quoted text clipped - 55 lines]
>         DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere,
> OpenArgs:=strDescrip
Will G - 09 Apr 2007 17:32 GMT
Hello,

thanks for your response,
i have been trying to include RequiredDate to my bound columns but i just
dont know the code to do it i guess. i guess it should go something like

 strWhere = "[OrderNo] IN (" & Left$(strWhere, lngLen) & ") AND,,,,,,"
can you help me out with that...i dont know where to go from there......and
can it please apply to the previous code bellow. thanks

Signature

need help

> It looks to me like your primary key is not just Orderno, but also required
> date. In your strWhere you will need to give both. You can do this by looking
[quoted text clipped - 63 lines]
> >         DoCmd.OpenReport strDoc, acViewPreview, WhereCondition:=strWhere,
> > OpenArgs:=strDescrip
 
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.