+ Reply to Thread
Results 1 to 4 of 4

Error - No value given for one or more required parameters

  1. #1
    Registered User
    Join Date
    02-12-2009
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    7

    Error - No value given for one or more required parameters

    Hey everyone, I'm trying to use a recordset with an access database to pull some employee information... here is my code

    Please Login or Register  to view this content.
    When I run the program, the values of the variables are as follows:

    myRecordSet = <Object or With block variable not set>
    strConnect = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Temp\class.mdb;"
    strSQL = "SELECT * FROM Employees WHERE FirstName = 'Ellen';"


    Seems like there is something fishy with myRecordSet, I have loaded all the appropriate object references, but maybe there is something wrong with my declaration. Can anyone help??



    Thanks,

    Jimmy

  2. #2
    Forum Administrator ExlGuru's Avatar
    Join Date
    03-17-2009
    Location
    India
    MS-Off Ver
    2003,2007
    Posts
    222

    Re: Error - No value given for one or more required parameters

    I think Your problem is easily resolved by using the ADODB command object
    instead of a recordset object for performing Updates, Deletes, and
    Inserts. These are all action items. For Action items you want to
    think in terms of the command object. For reads you can use the
    recordset objects. With ADO.Net you can use a DataReader object for
    reading; much nicer and easier to work with.

    Here is a sample using the command object:

    Please Login or Register  to view this content.
    Here I am assuming tbl1 contains all text fields. Thus, delimit with
    single quotes "'". For numeric - no delimeters, for dates, use "#" the
    pound sign.
    ExlGuru

  3. #3
    Registered User
    Join Date
    02-12-2009
    Location
    Denmark
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Error - No value given for one or more required parameters

    ExlGuru, I greatly appreciate your assistance, but unfortunately I am required to use the recordset object in this case. That given, is there anything that seems to be visibly wrong with what I coded that would create that error? It seems to me that the myRecordSet variable shouldn't be equal to <Object or With block variable not set> but I'm not sure what is going wrong.

    Do you, or anyone else, have any ideas?

    Thanks again.

  4. #4
    Forum Administrator ExlGuru's Avatar
    Join Date
    03-17-2009
    Location
    India
    MS-Off Ver
    2003,2007
    Posts
    222

    Re: Error - No value given for one or more required parameters

    Try this

    Please Login or Register  to view this content.
    In place of

    myRecordSet.Open strSQL, strConnect, adOpenForwardOnly 'Error occurs here

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1