1

Topic: To deduce in the form request runtime to a DB

Kind hour, !
I perform laboratory operation, its essence in that in to generate a certain amount of the casual data in the table and to count time of their performance.

Option Compare Database
Sub randomDigits (tableName, fldOt, fldDo, n)
Start_time = Time ()
Dim i
Randomize
With CurrentDb. OpenRecordset ("select * from [" AND tableName AND "]")
For i = 1 To n
.AddNew
! number = Rnd (i) * (fldDo - fldOt) + fldOt
.update
Next
End With
End_time = Time ()
End Sub
Sub button_Click ()//procedure for data reading from appropriate fields of the form
n = Number19 ()
fldOt = number_ot ()
fldDo = number_do ()
randomDigits "table", number_ot, number_do, n
End Sub

How it is possible to count not runtime of this code, namely time from beginning to end creations necessary kol-va records in a database and to deduce in the form?

2

Re: To deduce in the form request runtime to a DB

Di666 wrote:

to count not runtime of this code, namely time from beginning to end creations necessary kol-va records in a database

And in what a difference?

Di666 wrote:

With CurrentDb. OpenRecordset ("select * from [" AND tableName AND "]")

And why it is not simple

With CurrentDb. OpenRecordset (tableName)

?

3

Re: To deduce in the form request runtime to a DB

Look here at it function Usage timeGetTime () for optimization of applications on Access Probably helps.

4

Re: To deduce in the form request runtime to a DB

Akina wrote:

And why it is not simple

CurrentDb. OpenRecordset (tableName)

?

And here at me sometimes expression

CurrentDb. OpenRecordset (tableName)

produced an error. And here

CurrentDb. OpenRecordset ("select * from [" AND tableName AND "]")

worked normally. And it was on tables. If to substitute request there problems never was.
Why so happened, and did not clarify. Simply took for itself for a rule, to open  on tables through SELECT.

5

Re: To deduce in the form request runtime to a DB

Joss wrote:

And here at me sometimes expression

CurrentDb. OpenRecordset (tableName)

Produced an error

Similarly. As always, there was no time to understand, if who knows the reason, write, .

6

Re: To deduce in the form request runtime to a DB

MrShin wrote:

it is passed...
Similarly. As always, there was no time to understand, if who knows the reason, write, .

it is is specific about it : should be String

CurrentDb. OpenRecordset ("tableName")

From HELP: "a source-expression or a type variable String , defining record source for new object Recordset. As record source it is possible to fill out a table or request name, and also instruction SQL which returns records."

7

Re: To deduce in the form request runtime to a DB

At me tabName also was  a variable. And substitution of a name of the table so-called a problem did not solve.

8

Re: To deduce in the form request runtime to a DB

Joss;
- the Shaitan!! smile))

9

Re: To deduce in the form request runtime to a DB

Joss;
- the Shaitan!! smile))
(got used to trust it HELPu-is improbable that written in it false)

10

Re: To deduce in the form request runtime to a DB

That's just the point that the error arose not always. Wrote on one computer - all works. Changed for another - an error. Why, why? Not clearly. Or other case. The program is debugged, all works. In couple of days you launch - an error. And again it is clear nothing. Can different updates, can the table was corrected... Well I did not understand it.