Option Compare Database
Option Explicit
'Replace txtClipboard with oficio2
Private Sub cmdCopy_Click()
On Error GoTo Err_cmdCopy_Click
Dim fOK As Boolean
Dim strTemp As String
If IsNull(Me!Oficio2) Or Me!Oficio2 = "" Then
MsgBox "Error: Could not write Null or empty string to Clipboard."
Exit Sub
Else
strTemp = Me!Oficio2
fOK = SetClipboardData_clt(strTemp)
End If
If Not fOK Then
MsgBox "Error: Could not write to the Clipboard."
Else
MsgBox "The Text Box contents have been written to the Clipboard."
End If
Exit_cmdCopy_Click:
Exit Sub
Err_cmdCopy_Click:
MsgBox Err.Description
Resume Exit_cmdCopy_Click
End Sub
Function SetClipboardData_clt(strText As String) As Boolean
On Error GoTo err_SetClipboardData_clt
' Comments : Writes the supplied string to the clipboard
' Parameters: strText - text to write
' Returns : True if successful, False otherwise
'
Dim lngHoldMem As Long
Dim lngGlobalMem As Long
Dim lngClipMem As Long
Dim lngTemp As Long
lngHoldMem = clt_GlobalAlloc(&H42, Len(strText) + 1)
lngGlobalMem = clt_GlobalLock(lngHoldMem)
lngGlobalMem = clt_lstrCpy(lngGlobalMem, strText)
If clt_GlobalUnlock(lngHoldMem) = 0 Then
If clt_OpenClipboard(0&) <> 0 Then
lngTemp = clt_EmptyClipBoard()
lngClipMem = clt_SetClipboardData(1, lngHoldMem)
lngTemp = clt_CloseClipboard()
End If
End If
SetClipboardData_clt = True
exit_SetClipboardData_clt:
Exit Function
err_SetClipboardData_clt:
SetClipboardData_clt = False
Resume exit_SetClipboardData_clt
End Function
Private Sub cmdClearTxtBox_Click()
On Error GoTo Err_cmdClearTxtBox_Click
Me!Oficio2 = Null
Me!lblClipboard.Caption = "The Text Box has been cleared."
Exit_cmdClearTxtBox_Click:
Exit Sub
Err_cmdClearTxtBox_Click:
MsgBox Err.Description
Resume Exit_cmdClearTxtBox_Click
End Sub
Private Sub NuevaPersona_Click()
On Error GoTo Err_NuevaPersona_Click
Dim stDocName As String
stDocName = "openTable"
DoCmd.RunMacro stDocName
Exit_NuevaPersona_Click:
Exit Sub
Err_NuevaPersona_Click:
MsgBox Err.Description
Resume Exit_NuevaPersona_Click
End Sub
Private Sub VerTodos_Click()
On Error GoTo Err_VerTodos_Click
Dim stDocName As String
stDocName = "ViewAll"
DoCmd.RunMacro stDocName
Exit_VerTodos_Click:
Exit Sub
Err_VerTodos_Click:
MsgBox Err.Description
Resume Exit_VerTodos_Click
End Sub
Private Sub save_Click()
On Error GoTo Err_save_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_save_Click:
Exit Sub
Err_save_Click:
MsgBox Err.Description
Resume Exit_save_Click
End Sub
Private Sub Previous_years_Click()
On Error GoTo Err_Previous_years_Click
Dim stDocName As String
stDocName = "ViewOld"
DoCmd.RunMacro stDocName
Exit_Previous_years_Click:
Exit Sub
Err_Previous_years_Click:
MsgBox Err.Description
Resume Exit_Previous_years_Click
End Sub
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
Me.Oficio2.SetFocus
DoCmd.RunCommand acCmdCopy
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click
End Sub
Private Sub cmd_GoToAppendOldYear_Click()
On Error GoTo Err_cmd_GoToAppendOldYear_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frm_AppendOldYear"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmd_GoToAppendOldYear_Click:
Exit Sub
Err_cmd_GoToAppendOldYear_Click:
MsgBox Err.Description
Resume Exit_cmd_GoToAppendOldYear_Click
End Sub
Private Sub nuevacarta_Click()
On Error GoTo Err_nuevacarta_Click
DoCmd.GoToRecord , , acNewRec
Exit_nuevacarta_Click:
Exit Sub
Err_nuevacarta_Click:
MsgBox Err.Description
Resume Exit_nuevacarta_Click
End Sub
Private Sub exit_Click()
On Error GoTo Err_exit_Click
Dim stDocName As String
stDocName = "quit"
DoCmd.RunMacro stDocName
Exit_exit_Click:
Exit Sub
Err_exit_Click:
MsgBox Err.Description
Resume Exit_exit_Click
End Sub