Thread: Edit datagrid
View Single Post
Old 08-06-2004, 12:00 PM   #1 (permalink)
techthis
 
Newb Techie

Join Date: Jun 2004

Posts: 10

techthis

Question Edit datagrid

hello...i just created a datagrid that gets populated from an access database...the user can perform a search and data pertaining to the query will now repopluate the datagrid...the problem is that i would like to edit a certain field and the newly populated datagrid wont let me...how can i do this?...here is my code...thanks for your time...
-------------------------------------
Option Explicit
Dim Conn As ADODB.Connection 'Connection
Dim Rs As ADODB.Recordset 'Recordset
Dim strQuery As String 'Command

Private Sub cmdSearch_Click()

Set Conn = New ADODB.Connection
With Conn
.CursorLocation = adUseClient
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Cigs\StoreCig.mdb"
.Open
End With

strQuery = "SELECT * FROM Orders " & _
"WHERE UPC = '" & txtSearch.Text & "'"

Set Rs = New ADODB.Recordset
With Rs
Set .ActiveConnection = Conn
.CursorType = adOpenStatic
.Source = strQuery
.Open
End With

Set DataGrid1.DataSource = Rs
With DataGrid1
.Refresh
End With

End Sub

Private Sub cmdSet_Click()
Rs.Close
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
End Sub
techthis is offline