Results 1 to 15 of 15

Thread: Replace syntax - help

  1. #1

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

    Arrow Replace syntax - help

    There is any command to replace the selected / all record to a value

    table = book
    field = bookname


    for example in foxpro we use : replace all bookname with "VB"

    whether any similar command is there in vb (other than sql command)


    thanks

    Rahul 2 kind

    ----------------

    I wanted the replace syntax in VB
    Last edited by Rahul2kind; Sep 4th, 2001 at 07:20 AM.

  2. #2
    Medicus
    Guest
    What a strait question like an arrow.

    It's * or LIKE or something.

    You need to take a look at VB, ACCESS, SQL... and all the others.

    The only thing here that I can see is the "/" witch could be translatted to an asterix *.

    Just wait till the big guys wake up

  3. #3

  4. #4
    wossname
    Guest
    Martin, I think Rahul's talkin about databases dude

  5. #5

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

    table

    Hi !

    I wanted to replace the all the data in a table to Zero

    Table : Item

    fields : itno, qty

    VB command to replace all qty with 0 (zero).

    Can any one give me a solution

    Thankx


    Replace

  6. #6

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

    Thumbs down No solution

    Any Solution or Suggestion

  7. #7
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    I dont think there's a command that will do this for you.

    What I would do is search through each record on the table and set its .Value property to 0
    This is of course assuming the value of the field can be a 0.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  8. #8

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

    I see

    Thanks

    For sql syntax

    update item set qty = 0

    But it is not working can anybody tell me the SQL syntax
    Last edited by Rahul2kind; Sep 8th, 2001 at 06:44 AM.

  9. #9

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

    sql

    Can anybody tell me the SQL syntax


    Thanks

  10. #10
    Addicted Member flavorjatin's Avatar
    Join Date
    Sep 2001
    Location
    India
    Posts
    154
    hi,

    SQL syntax you tried is perfectly fine with numeric field. If you are changing value in text field make sure to put quotes.

    bye.
    Best Regards.

  11. #11

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

    Not working in ACESSS

    The sql statement is not working in MSAccess

    update item set qty = 0

    qty is numeric field

    Giving runtime error : '3219' invalid operation

  12. #12

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

    Angry

    Any solutions ?????

  13. #13
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Perhaps try something like this ?

    VB Code:
    1. Set RS = DB.OpenRecordset("SELECT * FROM CompanyInfoTable WHERE RecNum = '" & currRecNum & "'", dbOpenDynaset, dbSeeChanges, dbOptimistic)
    2.     With RS
    3.         .Edit
    4.         RS.Fields("SomeField").Value = ""
    5.         'or
    6.         RS.Fields("SomeField").Value = 0
    7.         'or
    8.         RS.Fields("SomeField").Value = "0"
    9.         .Update
    10.     End With
    11. End Sub
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Location
    Delhi, INDIA
    Posts
    68
    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


    ----------


  15. #15

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

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