Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid

Status
Not open for further replies.

Maypen

Technical User
Feb 6, 2003
32
GB
Hi Guys,
i am doing a project which involves the user double clicking on a row on a datagrid on one form and this action populate the next empty row in another datagrid in another form with that data. I also need the row on the new form to have one cell empty so i can put a quantity in there. I also need to know how to specify the position of the empty cell.

I can populate textboxes from a datagrid but i dont know how to do so for another grid.Thanks for any help. Below is my code for the datagrid:

Set selectStock = New ADODB.Connection
selectStock.ConnectionString = _
"Provider = Microsoft.Jet.OLEDB.4.0; Data Source=C:\My Documents\GP project\gpframings.mdb"
selectStock.Open


Set rsSelect = New ADODB.Recordset
selectSql = "Select stockcode, stockdescription, price From stock"


With rsSelect
.ActiveConnection = selectStock
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open selectSql

End With

If rsSelect.BOF = True Or rsSelect.EOF = True Then
Exit Sub

End If

Set DataGrid1.DataSource = rsSelect
DataGrid1.Refresh
End Sub
 
Is the second grid linked to a table ?
If so, I suppose you could populate the table with an insert statement. And then refresh the datagrid so that the new line will show ?

I actually use other type of grids, like MSFlexGrid or MSHFlexgrid.
In those grid there is a "texmatrix" property :
grid.texmatrix(TheRow,TheCol)="TheValue"
or for a new line
grid.additem(ValueCol1 & Chr(9) & valueCol2 )


 
Thanks for your reply cbsm. Sorry i did not get back earlier.The second grid is not bound (but i have no problem it with it being bound). If it was bound, can you give me an idea of the Insert syntax as i am at a lost of how to do it.

By the way the second grid is being used to collect all the items which make up an order. These will then be priced up. Cheers for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top