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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding up numbers listbox - but not adding duplicates

Status
Not open for further replies.

webfaktor

Technical User
May 22, 2001
22
0
0
Hi - I have an access 2000 form / list box that users can drag and drop entries into. each entry is uniquely identified by the contents found in column 1. each entry has a number/time association found in column 2.

why I am writing is to try and find out how I can add up the number/times found in coulmn 2, but only adding them once should someone drag and drop them to the list two or more times. I have learned how to add up the number/times via a text box on the form, but (as I've written above) I can't figure how to add them one time only???

Advance thanks,

WF

 
Since they are uniquely identified by a column, can you just prevent them from adding something more than once? If not, how are you doing your calculation, one at a time as they add each item or at the end when they are finished?

If you are calculating as they are added, check the new value to see if it is already in the list before adding it.

Good Luck!
 
Hi SBendBuckeye,

In my circumstance they need be able to add an item more than once, as this database is designed to establish training agendas.
For example:
Coulmn A: Course 1, Column B: 180 (note 180 = 180 minutes or 3 hours)
Column A: 15 minute break, Column B: 15
Column A: Course 1, Column B: 180

how I am doing my calculation, is one at a time as they add each item with the following formula placed in a text box on the form.

=Format(DSum("[MMModTime_Minutes]","Qry_Ma_CourseMMMods_Temp")/60,"00.00")

They don't necessarily need to be added up one at a time - just so that they can at sometime before leaving the form see what the total time is.

 
HELLO GUYS,HELP PLEASE.
IN RESPONSE TO:

I would like to know how to link items on a list box to say a query, form or a report. I have a list box with items like: Search - By Customer, By Company Name by Product. I would specifically like to know how to link these items on the list box to the related forms or queries
The list box located on the main siwtchboard form would have 4 sections/headings, Orders, Search, View and Reports and would be arranged in the following order:

Order

Search By Customer name
By Company Name
By Channel Partner

View

Products
Payment Methods
Shipping Methods
Employees

Reports

Sales By Customer
Sales By Employee
Sales By Product Sales
By Channel Partner

everything in the list box with the exception of the headings would be linked to respective forms or reports.

I WAS GIVEN THE FOLLOWING:

Create a table named "tblMenuItems" with the following columns:
Field Name Data Type Description
---------- --------- -----------
Sequence Number(Integer) <- Primary key
MenuItem Text Text to show in list box
ItemType Text(1) F=Form, R=Report
ItemName Text Form/Report name
You could enter this information directly into the list box if you wanted, but keeping it in a table makes it easier to make changes later. The Sequence field lets you change the order of items in the list, or insert new items in the middle.

In your list box control (let's call it lstMenu), set the following properties:
Row Source Type: Table/Query
Row Source: tblMenuItems
Column Count: 4
Column Width: 0;;0;0
Bound Column: 1

In lstMenu's DoubleClick event, use code like the following to open the form or report:
Private Sub lstMenu_DoubleClick()
Dim strType As String, strName As String

With lstMenu
strType = .Column(2, .ListIndex)
strName = .Column(3, .ListIndex)
Select Case strType
Case &quot;F&quot;
DoCmd.OpenForm strName
Case &quot;R&quot;
DoCmd.OpenReport strName
End Select
End With
End Sub

BEING A NOVICE IN V.B:
WITH REGARDS TO THE LAST BIT CONCERNING THE EVENT PROCEDURE, WOULD I HAVE TO CREATE THE SAME PROCEDURE FOR EACH ITEM IN THE COMBO BOX? I KNOW I SAID LINK BOX ABOVE BUT WHAT I MEANT WAS COMBO BOX.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top