- Version
- Download 113
- File Size 548.04 KB
- File Count 1
- Create Date March 2, 2016
- Last Updated March 2, 2016
Upload RTF File in Visual Basic and MS Access
Upload RTF File in Visual Basic and MS Access
Sample source code on how to upload, update and view list of rtf files in database.
A step by step tutorial is also included in the download file.
Sample Code:
'get filename
Sub GetFilename()
On Error Resume Next
Dim lstitem As ListItem, a As Integer, localrs As New ADODB.Recordset, msql As String
If localrs.State = adStateOpen Then localrs.Close
msql = " select myfile from lessonfile where lessons='" & listQuickLaunch.SelectedItem.Text & "'"
'msql = " select myfile from lessonfile where lessonname='" & StudentMainFrm.listQuickLaunch.SelectedItem.Text & "' and lessons='" & listQuickLaunch.SelectedItem.Text & "'"
localrs.Open msql, dbCN, adOpenDynamic, adLockOptimistic
Do While Not localrs.EOF
Filepath = localrs(0).Value
txtpath.Text = localrs(0).Value
localrs.MoveNext
Loop
End Sub
'list of rtf file
Sub ListLessons()
Dim localrs As New ADODB.Recordset, msql As String
If localrs.State = adStateOpen Then localrs.Close
msql = "Select lessons from lessonfile "
localrs.Open msql, dbCN
listQuickLaunch.ListItems.Clear
Do While Not localrs.EOF
Set lstitem = listQuickLaunch.ListItems.Add(, , localrs(0).Value, 1, 1)
localrs.MoveNext
Loop
End Sub