Dear all,
I trust you are well. I am new to Vb 6.0 but I can say I have a basic knowledge in coding. My problem is, My instructor in VB had a graded recitation by coding on the spot! She asked me to display the record set in the data grid, and fortunately, I made it correctly. However, I didnt realize that she will ask further question and ask me to export the data grid values into excel or csv :( I feel so lost on that moment and feel embarassed in front of my classmates. But it triggers me to study more about the exporting. But of course with the help of your expertise Sir/Mam! could you kindly help me how we can sort this out :(
I am using vb 6.0. Please see my code below how did I put the recordset on the datagrid.
Thank you very much.
Rod
MODULE:
Public cn As New ADODB.Connection
Public rsODLN As New ADODB.Recordset
Public Sub DbaseIn()
Set cn = New Connection
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\CSMS\csms_03.mdb;Mode=ReadWrite;Persist Security Info=False;"
Set rsODLN = New Recordset
COMMAND BUTTON:
Call DbaseIn
rsODLN.Open "select * from ODLN", cn, adOpenStatic, adLockOptimistic
If rsODLN.RecordCount <> 0 Then
Set Datagrid1.Datasource = rdODLN
Else
MsgBox "No dat"
End If
I trust you are well. I am new to Vb 6.0 but I can say I have a basic knowledge in coding. My problem is, My instructor in VB had a graded recitation by coding on the spot! She asked me to display the record set in the data grid, and fortunately, I made it correctly. However, I didnt realize that she will ask further question and ask me to export the data grid values into excel or csv :( I feel so lost on that moment and feel embarassed in front of my classmates. But it triggers me to study more about the exporting. But of course with the help of your expertise Sir/Mam! could you kindly help me how we can sort this out :(
I am using vb 6.0. Please see my code below how did I put the recordset on the datagrid.
Thank you very much.
Rod
MODULE:
Public cn As New ADODB.Connection
Public rsODLN As New ADODB.Recordset
Public Sub DbaseIn()
Set cn = New Connection
cn.CursorLocation = adUseClient
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\CSMS\csms_03.mdb;Mode=ReadWrite;Persist Security Info=False;"
Set rsODLN = New Recordset
COMMAND BUTTON:
Call DbaseIn
rsODLN.Open "select * from ODLN", cn, adOpenStatic, adLockOptimistic
If rsODLN.RecordCount <> 0 Then
Set Datagrid1.Datasource = rdODLN
Else
MsgBox "No dat"
End If