Selecting random records in a continuous form

Sam Summers

Registered User.
Local time
Today, 20:46
Joined
Sep 17, 2001
Messages
939
I have a form that is based on a query.
I already have a button that opens a form containing a combobox to select a new location and this moves all the equipment in the original form to the selected location using an update query.
What I also need to do is to select random items and then move only these items to a new location using a similar method.
The forms properties are fine.
I have tried inserting a bound and unbound checkbox but this doesn't work.
If I create a form directly from the table I can do it, but there seems to be an issue with the form that is based on a query.
I have to bring up and then change the items that are located at a specified location.

Many thanks in advance if someone can shed some light on this silly problem.
 
Rnd function?

Sam Summers said:
I have a form that is based on a query.
I already have a button that opens a form containing a combobox to select a new location and this moves all the equipment in the original form to the selected location using an update query.
What I also need to do is to select random items and then move only these items to a new location using a similar method.
The forms properties are fine.
I have tried inserting a bound and unbound checkbox but this doesn't work.
If I create a form directly from the table I can do it, but there seems to be an issue with the form that is based on a query.
I have to bring up and then change the items that are located at a specified location.

Many thanks in advance if someone can shed some light on this silly problem.

Are you looking for a function that will select a random record?
You could do it in VBA like this:

RandomRecordID = (UpperBound - LowerBound + 1) * Rnd (Timer) + LowerBound

Where RandomPointID is the ID for the randomly selected point; UpperBound is a count of records; LowerBound is 0 (in this case); and Rnd(Timer) is a random function in Visual Basic that returns a number between 0 and 1. The Equation returns a number between 0 and the UpperBound.

Leo
 
Thanks for the reply,

I managed to solve this problem by using a procedure on the double click event that moved the selected record to a new location based on the text displayed in a combobox.
 

Users who are viewing this thread

Back
Top Bottom