D
Derek Wittman
Good afternoon,
I am working on including a random number between 0 and 1 in a field in an
already created table. I've only done one recordset in the past, but it
'seems' like a decent application for it.
I want to go down my table line by line and insert, without any parameters,
a random number into field "RandNo". I have the DAO 3.6 references in place
and have my looping figured out. My problem is that I don't recall when to
use the .edit and the .update.
Is there anyone willing to reply with 'aircode' that I can tailor to make
this happen? Here's what I have so far:
Option Explicit
Sub RandomCreator()
dim dbs as DAO.database, rst as DAO.recordset
dim strsql as string
set dbs = CurrentDb
set rst = dbs.openrecordset("tblslotdifficulty", dbOpentable)
With rst
.movelast
.movefirst
While not .EOF
strsql = "Update tblslotdifficulty SET
[tblslotdifficulty].[RandNo] = rnd()"
.movenext
Wend
End With
End Sub
I know that this isn't right. But I am fried as to what is...
Can someone please help? It is very much appreciated! Thank you!
Derek
I am working on including a random number between 0 and 1 in a field in an
already created table. I've only done one recordset in the past, but it
'seems' like a decent application for it.
I want to go down my table line by line and insert, without any parameters,
a random number into field "RandNo". I have the DAO 3.6 references in place
and have my looping figured out. My problem is that I don't recall when to
use the .edit and the .update.
Is there anyone willing to reply with 'aircode' that I can tailor to make
this happen? Here's what I have so far:
Option Explicit
Sub RandomCreator()
dim dbs as DAO.database, rst as DAO.recordset
dim strsql as string
set dbs = CurrentDb
set rst = dbs.openrecordset("tblslotdifficulty", dbOpentable)
With rst
.movelast
.movefirst
While not .EOF
strsql = "Update tblslotdifficulty SET
[tblslotdifficulty].[RandNo] = rnd()"
.movenext
Wend
End With
End Sub
I know that this isn't right. But I am fried as to what is...
Can someone please help? It is very much appreciated! Thank you!
Derek