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

Tip: Looking for answers? Try searching our database.

list box issues

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 04 Jul 2007 00:47 GMT
On a customer order form I have a List Box that lists previous delivery
address for this customer (DB is for a flower shop).
Now when I go into order history I want to be able to pull up an old order
and show the address selected as it was when the order was placed.

This is the code I have to display an old order:
Private Sub Form_Current()
   [Forms]![frmOrderEdit]![InvoiceNumber] =
[Forms]![frmOrdersList]![OrderID]
     Dim VarLr As Variant
   For Each VarLr In Me!DeliveryID.ItemsSelected
   Me!DeliveryID.Selected(VarLr) = False
Next VarLr

   If Forms![frmOrderEdit]![chkPickUp] = True Then
       Me.txtCoverBig.Visible = True
       Me.txtCoverSm.Visible = True
       Me.txtPickUp.Visible = True
       Me.lblDate.Caption = "PickUp Date:"
       Me.lblTime.Caption = "PickUp Time:"
       Me.DeliveryCharge.Value = "0.00"
Else
     Me.txtCoverBig.Visible = False
     Me.txtCoverSm.Visible = False
     Me.txtPickUp.Visible = False
     Me.lblDate.Caption = "Delivery Date:"
     Me.lblTime.Caption = "Delivery Time:"
End If

End Sub

This code seems to work fine most of the time - however if there WAS NO
DELIVERY ADDRESS SELECTED (maybe a pick up order)- this code generated and
error pointing here:

Me!DeliveryID.Selected(VarLr) = False

How can I fix this error.

Any help here will be appreciated.

Thanks in advance
D
AccessVandal - 04 Jul 2007 05:21 GMT
Hi Dave,

Not sure what you want exactly. If you want to skip the error, try insert
this line on top.

On Error Resume Next

Or

'-1 = True and 0 = False
If Me!DeliveryID.Selected(VarLr) = -1 Then  'if true process the loop
For Each VarLr In Me!DeliveryID.ItemsSelected
   Me!DeliveryID.Selected(VarLr) = False
Next VarLr
End if

>Dave wrote:

Signature

Please Rate the posting if helps you

 
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.