|
-
Feb 12th, 2001, 01:04 PM
#1
Thread Starter
Junior Member
I am opening a database with the above code but need it to open "adOpenKeyset" so that the dataGrid will be editable. Opens read only forward only by default and that does me no good. Here is the code: If cboContact.Text = "Home Alone" Then
Dim adoParameter As Parameter
Set adoConnect = New Connection
Set adoRecordset = New Recordset
adoConnect.CursorLocation = adUseClient
adoConnect.Open _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\HomeAlone\db1.mdb;Persist Security Info=False"
Set adoCommand = New Command
adoCommand.CommandText = "SELECT * from qryHaContactSearch WHERE City = ?"
Set adoParam = New Parameter
adoParam.Name = "City"
adoParam.Type = adVarChar
adoParam.Size = 20
adoParam.Value = Me.txtCity.Text
adoCommand.Parameters.Append adoParam
Set adoCommand.ActiveConnection = adoConnect
Set adoRecordset = adoCommand.Execute
Set DataGrid1.DataSource = adoRecordset
End If
I can't find a way to work it in so any help would be wildly appreciated. It's all I have left to finish my first big project. Thanks in advance 
Bill
-
Feb 13th, 2001, 01:38 AM
#2
Fanatic Member
Bill,
Instead of using
Set adoRecordset = adoCommand.Execute
try this:
Set adoRecordset.Source = adoCommand
adoRecordset.CursorLocation = adUseClient
adoRecordset.CursorType = adOpenKeyset
adoRecordset.Open
-
Feb 13th, 2001, 02:11 AM
#3
Thread Starter
Junior Member
Thanks so much!
That worked out perfectly! I just had to add the lock type to optimistic because it's read only by default and it works! That was the last piece of a 4 month project and I thank you to no end! Your friend,
Bill
-
Feb 13th, 2001, 02:13 AM
#4
Fanatic Member
Glad that I could help.
-
Feb 14th, 2001, 07:26 AM
#5
New Member
Hi!
try adding this to your code,
adoConnect.CursorType = adOpenKeyset
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
|