Results 1 to 4 of 4

Thread: Replace ! any solutions

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    Delhi, INDIA
    Posts
    68

    Angry Replace ! any solutions

    Hi !

    I was not able to find the proper answer to the replace command in VB using MSACCESS. Replacing all the records or range of records with a single syntax like "UPDATE ITEM SET QTY = 0 ". this command gives me the error.



    Please help

    thankx

    Link is given below


    http://www.vbforums.com/showthread.p...110#post524110[URL=Link to my post]

  2. #2
    Addicted Member
    Join Date
    Aug 2000
    Posts
    195
    Can you be more specific what kind of error it is?

    In the Query design make sure you have selected the correct table and that you are passing the right data type to the field /e.g. no missmatch like passing 0 to a string/
    Brandon

  3. #3
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Originally posted by Rahul2kind
    But I required the syntax so that in a single command or sets of command all the qty is set to 0

    This "Update item set qty = 0 " is working when I use directly in Visdata (Visual data manager in VB) sql statement, but through vb program it is given error when I refresh.


    My syntax

    f1.strRSname = "update item set qty= 0"
    Data2.DatabaseName = f1.strDBname
    Data2.RecordSource = f1.strRSname
    Data2.Refresh


    ----------

    think the problem is that u have to do an Execute on the SQL statement, not try to set it as the recordsource of a datacontrol.

    try something like this:

    VB Code:
    1. Data2.Database.Execute "update item set qty= 0"
    -= a peet post =-

  4. #4
    Addicted Member
    Join Date
    Aug 2000
    Posts
    195
    Absolutely correct.

    I didn't know you were seting recordset to that! This is an action query and you can not set a recordset object to it! It can only get executed!
    Brandon

Posting Permissions

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



Click Here to Expand Forum to Full Width