Beginner Using VBA Code Recordsource Object

D

Darly Pertuz

Saluti a tutto il team
Darly

George Walsh said:
I want to understand how to use VBA code to gain programmatic control of the
individual records of a field of data from a table in Access.

In my pursuit of this knowledge, I have been reading the Access help topics
relating to the recordset object - and I have been attempting to experiment
with code using the Visual Basic code editor using a practice database I
have created.

I have a ToDo table with a date field representing the due date of the
particular project described by the other fields associated with that
record.

All the records from this table are displayed in a datasheet on a sub-form.
A main form contains the sub-form and has a field that displays the current
date.

I want to write code that executes upon the event of displaying the sub-form
which evaluates the number of remaining days before the deadline, then I
would like to have the specific records in the ToDo table which still have
remaining days to go before the deadline - display with a background color
that graduates from yellow to orange and eventually to red as the remaining
days value becomes smaller.

I used to write QuickBasic (VB) code, so I am familiar with the elements of
VBA, generally. I also have lots of example databases and of course - the
examples in the Access Help feature.

Still, I am having problems. For example, I have recently been unable to
debug the code I write by pressing F8. Sometimes it works, and in past
efforts I have been able to use debug print and thereby display the values
of my variables in the immediate window as my code executes. But sometimes
the debug feature does not work; it's probably something I don't understand
about the debug process. Is there some special requirement before the debug
feature works? For example - does it only work when you write a Function?

Also, if I use the Me.recordset command to reference the recordsource of the
sub-form, how do I get the count of the number of records, and how do I
display the ToDo date field's value for each record?

Is there a good reference for learning the Access programming environment
and how to gain a more refined control of the Access table data via writing
code?

Even with all the examples from other programmers and Access help, I still
find there is such a vast amount of data to master about Access VBA Code -
and that each piece I master takes a painfully slow process to acquire.

Frequently, examples don't work, or require some unique adaptation that
itself requires specialized knowledge to implement.

It is especially distressing because I can do anything I want when I am
using Microsoft Excel, I would like to have the same degree of expertise
with Access. Why is Access so hard to master? Or is it?

I know I could benefit from someone with expertise who is willing to set me
on the right course and give me some direction. I am interested in knowing
how others have gained their skills. Are there formal courses that are of
benefit? How about a good book that doesn't reiterate all the simple basics
about tables, queries, forms, reports, etc. I have already mastered the
basics; it is the code writing that I specifically want to improve.
 
G

George Walsh

I want to understand how to use VBA code to gain programmatic control of the
individual records of a field of data from a table in Access.

In my pursuit of this knowledge, I have been reading the Access help topics
relating to the recordset object - and I have been attempting to experiment
with code using the Visual Basic code editor using a practice database I
have created.

I have a ToDo table with a date field representing the due date of the
particular project described by the other fields associated with that
record.

All the records from this table are displayed in a datasheet on a sub-form.
A main form contains the sub-form and has a field that displays the current
date.

I want to write code that executes upon the event of displaying the sub-form
which evaluates the number of remaining days before the deadline, then I
would like to have the specific records in the ToDo table which still have
remaining days to go before the deadline - display with a background color
that graduates from yellow to orange and eventually to red as the remaining
days value becomes smaller.

I used to write QuickBasic (VB) code, so I am familiar with the elements of
VBA, generally. I also have lots of example databases and of course - the
examples in the Access Help feature.

Still, I am having problems. For example, I have recently been unable to
debug the code I write by pressing F8. Sometimes it works, and in past
efforts I have been able to use debug print and thereby display the values
of my variables in the immediate window as my code executes. But sometimes
the debug feature does not work; it's probably something I don't understand
about the debug process. Is there some special requirement before the debug
feature works? For example - does it only work when you write a Function?

Also, if I use the Me.recordset command to reference the recordsource of the
sub-form, how do I get the count of the number of records, and how do I
display the ToDo date field's value for each record?

Is there a good reference for learning the Access programming environment
and how to gain a more refined control of the Access table data via writing
code?

Even with all the examples from other programmers and Access help, I still
find there is such a vast amount of data to master about Access VBA Code -
and that each piece I master takes a painfully slow process to acquire.

Frequently, examples don't work, or require some unique adaptation that
itself requires specialized knowledge to implement.

It is especially distressing because I can do anything I want when I am
using Microsoft Excel, I would like to have the same degree of expertise
with Access. Why is Access so hard to master? Or is it?

I know I could benefit from someone with expertise who is willing to set me
on the right course and give me some direction. I am interested in knowing
how others have gained their skills. Are there formal courses that are of
benefit? How about a good book that doesn't reiterate all the simple basics
about tables, queries, forms, reports, etc. I have already mastered the
basics; it is the code writing that I specifically want to improve.
 

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