If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
|
Thread Tools | Display Modes |
#11
|
|||
|
|||
Random number query question
On Wed, 7 Jan 2009 16:30:07 -0800, Bob Waggoner
wrote: Sorry it took so long for me to get back to you on this. The holidays & All... I have this in my query - with the function you wrote earlier in the modules tab. Shuffle: RndNum([ValidationNum]) The problem is, I get "compile error in query expression 'RndNum([validationNum])'" Here's the code in the module: Public Function RndNum(vIgnore As Variant) As Double Static bRnd As Boolean If Not bRnd Then 'Initialize the random number generator once only bRnd = True Randomize End If RndNum = Rnd() End Function Open the module in the VBA editor. Select Debug... Compile my database. Do you get an error message? If so on what line, and what's the error? -- John W. Vinson [MVP] |
#12
|
|||
|
|||
Random number query question
John,
I'd really like to shake your hand. Thanks for being so insightful. It worked. I had a few compile errors that needed to be cleaned up. The problem with this particular code was the lack of ' in front of comments. I should'a known better. Anyway, thanks! "John W. Vinson" wrote: On Wed, 7 Jan 2009 16:30:07 -0800, Bob Waggoner wrote: Sorry it took so long for me to get back to you on this. The holidays & All... I have this in my query - with the function you wrote earlier in the modules tab. Shuffle: RndNum([ValidationNum]) The problem is, I get "compile error in query expression 'RndNum([validationNum])'" Here's the code in the module: Public Function RndNum(vIgnore As Variant) As Double Static bRnd As Boolean If Not bRnd Then 'Initialize the random number generator once only bRnd = True Randomize End If RndNum = Rnd() End Function Open the module in the VBA editor. Select Debug... Compile my database. Do you get an error message? If so on what line, and what's the error? -- John W. Vinson [MVP] |
#13
|
|||
|
|||
Random number query question
On Thu, 8 Jan 2009 05:41:00 -0800, Bob Waggoner
wrote: John, I'd really like to shake your hand. Thanks for being so insightful. It worked. I had a few compile errors that needed to be cleaned up. The problem with this particular code was the lack of ' in front of comments. I should'a known better. Anyway, thanks! Glad I was able to point you in the right direction; good luck! -- John W. Vinson [MVP] |
|
Thread Tools | |
Display Modes | |
|
|