Rotating records

J

JZ

I have a form that brings up a group of business names for
us to give to callers. Is there a way to rotate the names
so that the same name doesn't always come up first and
that we are not always referring the same company.

Thanks,

JZ
 
T

tina

well, you could try this:

add a Yes/No field to the underlying table, as Referred. set the form's
RecordSource to a query with criteria WHERE Referred = False. set the form's
On Current event with a procedure to checkmark the box, as

Me!Referred = True
(you don't have to have a control for Referred on the form, just make sure
the field is in the underlying query.)

preface whatever code you use to open the form, with the following:

If DCount("*","UnderlyingQueryName") < 1 Then
DoCmd.RunSQL "UPDATE TableName SET Referred = False", False
End If

what happens is: every time the form is opened, only the businesses records
with Referred = False will be loaded. each time a business record is
selected, the Referred field is changed to True, so that record won't be
loaded the next time the form is opened. before the form is opened each
time, the code checks to see if the underlying query pulls any records. if
no, then the code changes Referred to False in every table record - and the
cycle starts all over again.
this is pretty clunky, as solutions go, and will work best in a "Single
Form" view, but it should work.

hth
 

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