|
-
Oct 2nd, 2000, 06:42 AM
#1
Thread Starter
Lively Member
I have a table with 1024 records.
Register Value
----------------
1 13
2 1254
3 4543
4 135
etc.--> 1024
----------------
How the hell do I write a value to "Value" in a specific record when I know what record (e.g 1000) I want to write to?
The only thing I've come up with, is MoveNext until I reach the desired record, but that's so slow!
Please help me, gurus and semi-gurus!
D
-
Oct 2nd, 2000, 07:00 AM
#2
Fanatic Member
Use some SQL then create a recordset as follows
Code:
dim rs as New ADODB.Recordset
sSQL = "SELECT * FROM [Your Table] WHERE [Your Field]=100;"
rs.Open sSQL
Hope this is of use
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Oct 2nd, 2000, 07:13 AM
#3
Thread Starter
Lively Member
Hmmm...
VB says:
-----------------------------
User-defined type not defined
-----------------------------
Dunnowattado!
Thanks anyway, but could you explain it a little bit more in detail, please?
D
-
Oct 2nd, 2000, 07:26 AM
#4
Fanatic Member
Sorry Dragev
This should explain it better.
Make sure in your references you have the Microsoft AtiveX Data Objects Library 2.1 checked as well.
Code:
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim sSQL As String
'Open the connection to your database
Set cnn = New ADODB.Connection
With cnn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.Open "C:\MyDB.mdb"
End With
'Enter your table name and field name where appropriate, also remeber to enclose the
'value in "" if it is a string value
'i.e. sSQL = "SELECT * FROM tblMain WHERE ID =1000;"
sSQL = "SELECT * FROM [Your Table] WHERE [Your Field] =[Your value];"
'Open the recordset based on the SQL string
Set rs = New ADODB.Recordset
With rs
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Open sSQL, cnn
End With
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Oct 2nd, 2000, 07:46 AM
#5
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
|