businesshippieRH
Registered User.
- Local time
- Yesterday, 22:53
- Joined
- Aug 8, 2014
- Messages
- 60
I have a button that isn't running any code on click and I can't figure out why. Other buttons on the form work great, and code runs on load. Does anybody have any suggestions? Thanks in advance! Code is:
Code:
Private Sub btn_Upload_Click()
'Check UploadType
Dim RecDist As String
RecDist = DLookup("RecordDistinction", "tbl_Records", "RecordName= '" & Forms!frm_UPLOAD!txt_RecordName & "'")
Dim UploadType As String
UploadType = DLookup("UploadType", "tbl_RecordDistinctions", "RecordDistinction = '" & RecDist & "'")
Debug.Print UploadType
'Check for entries
If UploadType = "1" Then
If Me.txt_PDFLoc = "" Then
MsgBox "You must upload a PDF file for this Record!", vbExclamation, "Incomplete Form!"
Me.txt_PDFLoc.SetFocus
Cancel = True
Exit Sub
Else
'Copy File
'Set up strings for file names
'Old Path
Dim PDFFilePath As String
PDFFilePath = Me.txt_PDFLoc
'New Path
'String for adding file extension
strFileExtension = GetFileExt(Me.txt_PDFLoc)
'New Path Strings
Dim PDFNewTitle As String
PDFNewTitle = Me.txt_RecordName & "." & strFileExtension
Dim PDFRecFile As String
PDFRecFile = "T:\DATABASE\RecordsDB\Records\"
'Combined
Dim PDFNewFullPath As String
PDFNewFullPath = PDFRecFile & PDFFilePath
'Setup FSO Declarations
Dim FSO As New Scripting.FileSystemObject
If Not FSO Is Nothing Then 'Error Handling...
'CopyFile
FSO.CopyFile PDFFilePath, PDFNewFullPath, False
End If
If Me.txt_WORDLoc = "" Then
MsgBox "You must upload a MS Word file for this Record!", vbExclamation, "Incomplete Form!"
Me.txt_PDFLoc.SetFocus
Cancel = True
Exit Sub
Else
'Copy File
'Set up strings for file names
'Old Path
Dim DOCFilePath As String
DOCFilePath = Me.txt_WORDLoc
'New Path
'String for adding file extension
strFileExtension = GetFileExt(Me.txt_WORDLoc)
'New Path Strings
Dim DOCNewTitle As String
DOCNewTitle = Me.txt_RecordName & "." & strFileExtension
Dim DOCRecFile As String
DOCRecFile = "T:\DATABASE\RecordsDB\Records\"
'Combined
Dim DOCNewFullPath As String
DOCNewFullPath = PDFRecFile & PDFFilePath
'Setup FSO Declarations
Dim FSO As New Scripting.FileSystemObject
If Not FSO Is Nothing Then 'Error Handling...
'CopyFile
FSO.CopyFile DOCFilePath, DOCNewFullPath, False
End If
ElseIf UploadType = "1" Then
If Me.txt_PDFLoc = "" Then
MsgBox "You must upload a PDF file for this Record!", vbExclamation, "Incomplete Form!"
Me.txt_PDFLoc.SetFocus
Cancel = True
Exit Sub
Else
'Copy File
'Set up strings for file names
'Old Path
Dim PDFFilePath As String
PDFFilePath = Me.txt_PDFLoc
'New Path
'String for adding file extension
strFileExtension = GetFileExt(Me.txt_PDFLoc)
'New Path Strings
Dim PDFNewTitle As String
PDFNewTitle = Me.txt_RecordName & "." & strFileExtension
Dim PDFRecFile As String
PDFRecFile = "T:\DATABASE\RecordsDB\Records\"
'Combined
Dim PDFNewFullPath As String
PDFNewFullPath = PDFRecFile & PDFFilePath
'Setup FSO Declarations
Dim FSO As New Scripting.FileSystemObject
If Not FSO Is Nothing Then 'Error Handling...
'CopyFile
FSO.CopyFile PDFFilePath, PDFNewFullPath, False
End If
End If
End Sub