Go to first empty record

  • Thread starter Steven Greenberg
  • Start date
S

Steven Greenberg

Greetings all again,

I'm changing the way a database that I created to keep track of blood
glucose levels works and decided to "prefill" the date field for a complete
year to make entering data for my dad easier (he is quite naive with
computers). what I need to do now is have the form open up to the first
date that doesn't have values for the morning noon and night readings
instead of him having to search out the date.
for example the table would look like this:

date Morn Noon Night
2/1/05 100 120 100
2/2/05 120 110 90
2/3/05
2/4/05
....

When he next opens the form, I would like it to go to the 2/3/05 date
automatically. As most of you know, I am fairly knowlegable in VB and VBA,
I just don't want to rack my brains on this right now.
I suppose the docmd.gotorecord would work, but how do I tell it to check
the fields to find the first record that has three blank values? If I
played around with it I could probably work it out, but I've got other more
important things to worry about right now. If anyone has a suggestion, I
would appreciate hearing about it.
Thanks
Steve
 
A

Al Camp

Steven,
I'd try the OpenForm Where argument. (A97)
You don't say what the default value of Morn/Noon/Night is. (0 or Null)
"IsNull(Morn) And Isnull(Noon) And IsNull(Night)"
or
"Morn = 0... etc ...etc
hth
Al Camp
 
B

Bob Howard

Maybe you could use a dcount function to count the number of records that
have data and then position the form accordingly. Of maybe even filter the
records to only show the the ones (the first one) without data,
 
S

Steven Greenberg

Greetings all again,

I'm changing the way a database that I created to keep track of blood
glucose levels works and decided to "prefill" the date field for a
complete year to make entering data for my dad easier (he is quite
naive with computers). what I need to do now is have the form open up
to the first date that doesn't have values for the morning noon and
night readings instead of him having to search out the date.
for example the table would look like this:

date Morn Noon Night
2/1/05 100 120 100
2/2/05 120 110 90
2/3/05
2/4/05
...

When he next opens the form, I would like it to go to the 2/3/05 date
automatically. As most of you know, I am fairly knowlegable in VB and
VBA, I just don't want to rack my brains on this right now.
I suppose the docmd.gotorecord would work, but how do I tell it to
check the fields to find the first record that has three blank values?
If I played around with it I could probably work it out, but I've got
other more important things to worry about right now. If anyone has a
suggestion, I would appreciate hearing about it.
Thanks
Steve

I've been thinking about it last night and will probably try something
like:
creating a recordset clone. looping through until I come across the first
record that has three empty values, then just use the bookmark property to
set the actual recordsource to the clone one. I think that should work. I
have to try it out later.
Steve
 
A

Al Camp

Wonderful Steve, and... no need to thank us for taking the time to respond
to your question. And, no need to try the suggestions either. We realize
you've got more important things to do...

Al Camp
 

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