Click on a detail record field, reference the record?

K

kevinwjameson

I click on a detail record field in a form, and want to reference
other fields in that same record. In the OnClick handler, I can easily
see the field text value, and the Me.CurrentRecord number, like so:

Private Sub Tset_Click()
' I can see the text of the cell I clicked on (tset) fine.
' I can reference the current record in the grid fine too. (it's
record 12)
MsgBox "Tset field value is " & Tset.Text & ", current detail
record is (" & Me.CurrentRecord & ")"

' now how do I reference other cells on the same grid row?
Dim rs As ADODB.Recordset
Set rs = Me.Recordset ' gives an error too
Set rs = Me.RecordsetClone ' gives a type mismatch error
'MsgBox "The LType field is " & rs!LType ' I don't get this far
End Sub

Any help would be appreciated. I have read about RecordSetClone
requires the use of DAO, but that is a whole other project for me to
learn about. Is there any easier way to reference a record row in a
detail grid on a form? Thanks
 
S

Stefan Hoffmann

hi Kevin,

I click on a detail record field in a form, and want to reference
other fields in that same record.
You can easily access these fields with

Me![fieldName]

You don't need to specify the control bound to the field.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top