Link to home
Start Free TrialLog in
Avatar of Michael Paravicini
Michael ParaviciniFlag for Chile

asked on

How to access a cell in Datasheet in VBA Access

I have a form with a subform which displays a datasheet. This datasheet has a DATES column and I need to pass the first row data (in this case 28 of Feb 2016  as a parameter in the button SEGURO HOY. No clue on how to address this cell and to pass it on in the click event.
Thank you for any help... User generated image
Avatar of als315
als315
Flag of Russian Federation image

There are no "cells" in Access, there are records. You can get value from selected record by name of field (column)
In code of your button you can use Me.DATES to get value from selected (in picture it is first) record
Avatar of Michael Paravicini

ASKER

Thank you but the problem is that I'm using a filter and hence ME.Dates gets me only the first record in the table but not the first record displayed in the mask after applying the filter.....
You should select this record (you can do it with code also) and then Me.Dates will give you value from selected record
Sorry not sure how to select the first record of the active datasheet (without having going thru the trouble to use RecordSet etc).?
ASKER CERTIFIED SOLUTION
Avatar of als315
als315
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you so much - this has been unbelievable helpful!    Cheers Michael