How to access a cell in Datasheet in VBA Access

Michael Paravicini
Michael Paravicini used Ask the Experts™
on
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... Screen.jpeg
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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

Author

Commented:
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
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
Sorry not sure how to select the first record of the active datasheet (without having going thru the trouble to use RecordSet etc).?
Look at sample. If your form is different, upload sample DB with this form and related tables (remove any sensitive data)
Q28929353.accdb

Author

Commented:
Thank you so much - this has been unbelievable helpful!    Cheers Michael

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial