Results 1 to 3 of 3

Thread: Adox

  1. #1
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Unanswered: Adox

    Hello everyone,
    I am using the Adox.catalog to execute table creation query in a data base
    the query uses a function called makeRandom which it makes random numbers

    Dim cat As New adox.Catalog
    Dim cmd As ADODB.Command
    Dim lngCount As Long, resultedTableName As String

    'Initialize.
    cat.ActiveConnection = CurrentProject.Connection
    Set cmd = cat.Procedures(thisQueryName).Command
    the cmd.Command is something like that
    SELECT makeRandom(-1000,([KopierKontoNr]/1000),2) AS price
    INTO zz_Price
    FROM zz_ChipAlle;



    cmd.Execute lngCount
    when I try to execute the cmd.command it stops with an error that the makeRandom function is unknown

    I have the function in both mdb file and in the VB too

    How can I manage it
    Thanks in advance

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    what is the scope of the function (is it described as public function)
    where is it defined
    if its in an MDB it needs to be in a module
    does makerandom do anything different to the inbuilt random number (forget if its rnd or random)

    try a full compile
    try right cliocking the makerandom and select goto defintion and see waht it shows
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Thanks for your answer,
    the function makeRandom is defiend in the mdb as Public function
    it yealds only randoms between two limits

    PHP Code:
    Public Function makeRandom(lowerLim As IntegerupperLim As IntegernDigits) As Single   
       Randomize 
    (Timer)
       
    makeRandom =(Rnd * (upperLim lowerLim) + lowerLim)
    End Function 
    The function is defiend in VB and in MDB

    A full compilation shows no errors
    [because this is a run time one]

    The CommandType is set to adCmdUnknown
    Last edited by hammbakka; 11-04-08 at 09:33.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •