|
-
Jul 14th, 2001, 12:26 AM
#1
Thread Starter
Lively Member
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.
-
Jul 14th, 2001, 06:04 AM
#2
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
-
Jul 14th, 2001, 08:31 AM
#3
Code:
Dim strText As String
strText = "apple pear orange apple grape peach apple"
strText = Replace(strText, "apple", "kiwi", 1, -1)
MsgBox strText
-
Jul 14th, 2001, 01:25 PM
#4
Martin, I think Rahul's talkin about databases dude
-
Sep 4th, 2001, 07:07 AM
#5
Thread Starter
Lively Member
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
-
Sep 5th, 2001, 05:39 AM
#6
Thread Starter
Lively Member
No solution
Any Solution or Suggestion
-
Sep 5th, 2001, 05:55 AM
#7
Retired VBF Adm1nistrator
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]
-
Sep 5th, 2001, 06:33 AM
#8
Thread Starter
Lively Member
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.
-
Sep 8th, 2001, 06:46 AM
#9
Thread Starter
Lively Member
sql
Can anybody tell me the SQL syntax
Thanks
-
Sep 8th, 2001, 07:01 AM
#10
Addicted Member
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.
-
Sep 10th, 2001, 03:59 AM
#11
Thread Starter
Lively Member
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
-
Sep 11th, 2001, 02:05 AM
#12
Thread Starter
Lively Member
Any solutions ?????
-
Sep 11th, 2001, 02:35 AM
#13
Retired VBF Adm1nistrator
Perhaps try something like this ?
VB Code:
Set RS = DB.OpenRecordset("SELECT * FROM CompanyInfoTable WHERE RecNum = '" & currRecNum & "'", dbOpenDynaset, dbSeeChanges, dbOptimistic)
With RS
.Edit
RS.Fields("SomeField").Value = ""
'or
RS.Fields("SomeField").Value = 0
'or
RS.Fields("SomeField").Value = "0"
.Update
End With
End Sub
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
-
Sep 11th, 2001, 03:15 AM
#14
Thread Starter
Lively Member
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
----------
-
Sep 11th, 2001, 05:17 AM
#15
Thread Starter
Lively Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|