Hi,
If you run a query on ACCESS it is displayed in a datagrid. I then type Ctrl+A and Ctrl+C to copy the data from the datagrid into an Excel sheet. I was wondering how to set my VB datagrid to allow me to do the same.
Thanks,
RF
Printable View
Hi,
If you run a query on ACCESS it is displayed in a datagrid. I then type Ctrl+A and Ctrl+C to copy the data from the datagrid into an Excel sheet. I was wondering how to set my VB datagrid to allow me to do the same.
Thanks,
RF
Hi,
Try this :
private Sub CopyGrid1ToClipboard()
With Grid1
Clipboard.Clear
Clipboard.SetText .Clip
End With
End Sub
private Sub Grid1_KeyPress(KeyAscii as Integer)
'if the user made a selection
If (Grid1.col <> Grid.ColSel) Or (Grid.row <> Grid.RowSel) then
'CTRL + C = copy
If KeyAscii = 3 then
Call CopyGrid1ToClipboard
KeyAscii = 0
Exit Sub
End If
End If
End sub
Hope it helped.
Laurent VOISIN.