Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259

    Red face Unanswered: No value given for one or more parameters

    I get the error "No value given for one or more parameters" when i try to run this code

    Dim fileNumber As String
    fileNumber = [Forms]![Main Form]![File_Number]

    rec.Open "SELECT * FROM File_Table WHERE File_Table.File_Number=fileNumber;", conn, adOpenStatic, adLockOptimistic


    when i do a debug.print fileNumber, the number does exist becus the form is open...

    the file number is of string type
    thx for help
    Last edited by Jerrie; 02-09-04 at 10:58.

  2. #2
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    I'm assuming your filenumber is text because you've defined it as a string variable.

    rec.Open "SELECT * FROM File_Table WHERE File_Table.File_Number='" & fileNumber & "';", conn, adOpenStatic, adLockOptimistic

    Basically, your recordset doesn't know what fileNumber is. Your function/sub does.
    All code ADO/ADOX unless otherwise specified.
    Mike.

  3. #3
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    Dim fileNumber As String
    fileNumber = [Forms]![Main Form]![File_Number]
    rec.Open "SELECT * FROM File_Table WHERE (((File_Table.File_Number)=" & fileNumber & "));", conn, adOpenStatic, adLockOptimistic

    new error now: Data Type Mismatch in Criteria expression

    even though the filetable.file_number is a damn string; and the file_number on the form is a field that links to the table

    darn, this seems so stupid
    sry

  4. #4
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259
    actually figured it out;
    stupid access thing really

    when its a string

    you have to put '

    rec.Open "SELECT * FROM File_Table WHERE (((File_Table.File_Number)=' " & crazy & " '));", conn, adOpenStatic, adLockOptimistic |
    |
    ---------------------------------

  5. #5
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    My single quotes are hard to see, but they're there beside the double quotes, but yes, you are correct.
    All code ADO/ADOX unless otherwise specified.
    Mike.

Posting Permissions

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