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

Field value from multiple records in a datasheet

Status
Not open for further replies.

kenman

Programmer
Dec 21, 2000
12
0
0
US
I have a form that contains a subform/Datasheet. This datasheet displays multiple records. There are 5 fields, one called Total. Currently if the user selects 1 record, I can get the data (using msgbox) from the Total field by using the following syntax
Msgbox [subfrmOrderDetails]![Total]
This allows me to get a handle on the Total value for this record

I would like to allow the user to select multiple record using the record selector, and get the Total value for each of the records selected.

I would guess something like this....
Msgbox [subfrmOrderDetails]![Total].(0)
Msgbox [subfrmOrderDetails]![Total].(1)
Msgbox [subfrmOrderDetails]![Total].(2)

but since I need to know the difference if it is selected or not maybe something like
Msgbox [subfrmOrderDetails]![Total].Selected(0)
Msgbox [subfrmOrderDetails]![Total].Selected(1)
Msgbox [subfrmOrderDetails]![Total].Selected(2)

Any advice would be appreciated.

 
This worked form me
Code:
Private Sub Form_DblClick(Cancel As Integer)
  Dim intCounter As Integer
  Dim rs As DAO.Recordset
  Set rs = Me.RecordsetClone
  'This is the key line
  rs.AbsolutePosition = (SelTop - 1)
  For intCounter = 1 To SelHeight
    MsgBox rs.Fields("Total")
    rs.Move 1
  Next intCounter
End Sub
 
How are ya kenman . . .

Have a look here: How to Enumerate Selected Form Records

If you have any problems . . . let us know . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top