please i need your help am a newbie, i have a VBA codes that have browse, open and print in access but i want to add save to it that enables the file that is browsed to be saved but i cant go further please great programmers in the forum help me: the following are the codes in the form with a PDF showing image of what i have done so far:
Code:
Option Compare Database
Option Explicit
Private Sub cmdBrowse_Click()
On Error GoTo Err_Handler
Dim strFullpath As String
Dim strFolder As String
Dim strFile As String
Dim intPos As Integer
strFullpath = BrowseFile
If strFullpath <> "" Then
' get folder and file names
intPos = InStrRev(strFullpath, "\")
strFolder = Left(strFullpath, intPos - 1)
strFile = Mid(strFullpath, intPos + 1)
' populate text boxes on form
Me.txtFullPath = strFullpath
Me.txtFolder = strFolder
Me.txtFile = strFile
End If
Exit_Here:
Exit Sub
Err_Handler:
MsgBox Err.Description
Resume Exit_Here
End Sub
Private Sub cmdOpen_Click()
If Not IsNull(Me.txtFullPath) Then
ShellToFile Me.txtFullPath
End If
End Sub
Private Sub cmdPrintFile_Click()
If Not IsNull(Me.txtFullPath) Then
ShellToFile Me.txtFullPath, OP_PRINT
End If
End Sub
Private Sub Form_Resize()
' revert to Windows default printer
Set Application.Printer = Nothing
End Sub
Private Sub txtFile_Click()
cmdOpen_Click
Me.cmdOpen.SetFocus
End Sub
Private Sub txtFolder_Click()
If Not IsNull(Me.txtFolder) Then
ShellToFile Me.txtFolder
Me.cmdOpen.SetFocus
End If
End Sub
Private Sub txtFullPath_Click()
cmdOpen_Click
End Sub
Attachments
Last edited by a moderator: