Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 08-06-2004, 01:00 PM   #1 (permalink)
 
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  
Old 08-06-2004, 10:25 PM   #2 (permalink)
 
Newb Techie

Join Date: Jun 2004

Posts: 22

lexor

Default allowupdate

You should enabled the update option of the data grid.

In any part of your search button insert this code

Datagrid1.AllowUpdate = True
lexor is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On