Sure can.
Keep in mind that I am a novice when it comes to coding.
Thanks in advance.
This is the sub form:
Option Compare Database
Private Sub CboMapStatus_BeforeUpdate(Cancel As Integer)
Me.Date.Value = Now()
Me.txtUser.Value = CurrentUser()
End Sub
Private Sub CboMapStatus_GotFocus()
Me.TxtCompanyName = [Forms]![Contact Info]![CompanyName]
Me.TxtContractNumber = [Forms]![Contact Info]![ContractNumbers]
End Sub
Private Sub CboMapStatus_AfterUpdate()
On Error GoTo Err_CboMapStatus_AfterUpdate_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Dim x As Object
Dim strSubject As String
Dim strBody As String
Dim stDocName As String
stDocName = "RPT_MapRequestPCM"
Dim stDefault As String
stDefault = ""
Me.TxtComments.DefaultValue = stDefault
Me.TxtFieldsIgnore.DefaultValue = stDefault
Me.TxtFtpFilename.DefaultValue = stDefault
Me.CboBusinessNeed.DefaultValue = stDefault
Me.CboFileFormat.DefaultValue = stDefault
Me.CboMapStatus.DefaultValue = stDefault
Me.CboRequestType.DefaultValue = stDefault
Me.CboSubmittype.DefaultValue = stDefault
Me.CboMapAssign.DefaultValue = stDefault
Me.TxtFtpLogin.DefaultValue = stDefault
Me.TxtIgnoreFields.DefaultValue = stDefault
Me.TxtLogic.DefaultValue = stDefault
Me.TxtLogicNeeded.Value = stDefault
Me.TxtMultipleMaps.DefaultValue = stDefault
Me.TxtPassword.DefaultValue = stDefault
Me.TxtPped.DefaultValue = stDefault
Me.TxtTestFile.DefaultValue = stDefault
Me.TxtTransferDate.DefaultValue = stDefault
Me.TxtRevisionChange.DefaultValue = stDefault
Me.CboMapAssign.DefaultValue = stDefault
Me.TxtTargetDate.DefaultValue = stDefault
If MsgBox("Do you really want to do this?", vbYesNo) = vbYes Then
DoCmd.SendObject acReport, stDocName, "Rich Text", "DeHaai.Wendi@principal.
com; (e-mail address removed); (e-mail address removed); Yochum.
(e-mail address removed); (e-mail address removed); Burch.Robert@principal.
com; (e-mail address removed)", , , Me.CboRequestType.Value & " for: " &
Me.TxtCompanyName & " - " & Me.TxtContractNumber
End If
Exit_CboMapStatus_AfterUpdate_Click:
Exit Sub
Err_CboMapStatus_AfterUpdate_Click:
MsgBox Err.Description
Resume Exit_CboMapStatus_AfterUpdate_Click
End Sub
Private Sub CmdClear_Click()
On Error GoTo Err_CmdClear_Click
Dim stDefault As String
stDefault = ""
Me.TxtComments.DefaultValue = stDefault
Me.TxtFieldsIgnore.DefaultValue = stDefault
Me.TxtFtpFilename.DefaultValue = stDefault
Me.CboBusinessNeed.DefaultValue = stDefault
Me.CboFileFormat.DefaultValue = stDefault
Me.CboMapStatus.DefaultValue = stDefault
Me.CboRequestType.DefaultValue = stDefault
Me.CboSubmittype.DefaultValue = stDefault
Me.CboMapAssign.DefaultValue = stDefault
Me.TxtFtpLogin.DefaultValue = stDefault
Me.TxtIgnoreFields.DefaultValue = stDefault
Me.TxtLogic.DefaultValue = stDefault
Me.TxtLogicNeeded.Value = stDefault
Me.TxtMultipleMaps.DefaultValue = stDefault
Me.TxtPassword.DefaultValue = stDefault
Me.TxtTargetDate.DefaultValue = stDefault
Me.TxtPped.DefaultValue = stDefault
Me.TxtTestFile.DefaultValue = stDefault
Me.TxtTransferDate.DefaultValue = stDefault
Me.TxtRevisionChange.DefaultValue = stDefault
Me.CboMapAssign.DefaultValue = stDefault
Me.TxtTargetDate.DefaultValue = stDefault
Exit_CmdClear_Click:
Exit Sub
Err_CmdClear_Click:
MsgBox Err.Description
Resume Exit_CmdClear_Click
End Sub
Private Sub Form_Current()
Me.TxtCompanyName = [Forms]![Contact Info]![CompanyName]
Me.TxtContractNumber = [Forms]![Contact Info]![ContractNumbers]
End Sub
Private Sub cmdSetDefaults_Click()
On Error GoTo Err_cmdSetDefaults_Click
Me.TxtComments.DefaultValue = """" & Me.TxtComments.Value & """"
Me.TxtFieldsIgnore.DefaultValue = """" & Me.TxtFieldsIgnore.Value & """"
Me.TxtFtpFilename.DefaultValue = """" & Me.TxtFtpFilename.Value & """"
Me.CboBusinessNeed.DefaultValue = """" & Me.CboBusinessNeed.Value & """"
Me.CboFileFormat.DefaultValue = """" & Me.CboFileFormat.Value & """"
Me.CboMapStatus.DefaultValue = """" & Me.CboMapStatus.Value & """"
Me.CboRequestType.DefaultValue = """" & Me.CboRequestType.Value & """"
Me.CboSubmittype.DefaultValue = """" & Me.CboSubmittype.Value & """"
Me.CboMapAssign.DefaultValue = """" & Me.CboMapAssign.Value & """"
Me.TxtFtpLogin.DefaultValue = """" & Me.TxtFtpLogin.Value & """"
Me.TxtIgnoreFields.DefaultValue = """" & Me.TxtIgnoreFields.Value & """"
Me.TxtLogic.DefaultValue = """" & Me.TxtLogic.Value & """"
Me.TxtLogicNeeded.DefaultValue = """" & Me.TxtLogicNeeded.Value & """"
Me.TxtMultipleMaps.DefaultValue = """" & Me.TxtMultipleMaps.Value & """"
Me.TxtPassword.DefaultValue = """" & Me.TxtPassword.Value & """"
Me.TxtPped.DefaultValue = """" & Me.TxtPped.Value & """"
Me.TxtRevisionChange.DefaultValue = """" & Me.TxtRevisionChange.Value &
""""
Me.TxtTargetDate.DefaultValue = """" & Me.TxtTargetDate.Value & """"
Me.TxtTestFile.DefaultValue = """" & Me.TxtTestFile.Value & """"
Me.TxtTransferDate.DefaultValue = """" & Me.TxtTransferDate.Value & """"
Exit_cmdSetDefaults_Click:
Exit Sub
Err_cmdSetDefaults_Click:
MsgBox Err.Description
Resume Exit_cmdSetDefaults_Click
End Sub
Private Sub CmdDel_Click()
On Error GoTo Err_CmdDel_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_CmdDel_Click:
Exit Sub
Err_CmdDel_Click:
MsgBox Err.Description
Resume Exit_CmdDel_Click
End Sub
Private Sub CmdUndo_Click()
On Error GoTo Err_CmdUndo_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Exit_CmdUndo_Click:
Exit Sub
Err_CmdUndo_Click:
MsgBox Err.Description
Resume Exit_CmdUndo_Click
End Sub
Here is the Main form:
Option Compare Database
Private Sub AST_AfterUpdate()
txtAsst_ID.Value = AST.Column(0)
txtCSA_Asst_Number.Value = AST.Column(2)
txtCSA_Asst_Email.Value = AST.Column(3)
End Sub
Private Sub AST_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
Dim CSA As AccessObject
strMsg = "'" & NewData & "' is not in our list. " & vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to add " & NewData & " to the list? "
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add or No to re-type it.
"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Set db = CurrentDb
Set rs = db.OpenRecordset("TBL_CSA_Asst_List", dbOpenDynaset)
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("TBL_CSA_Asst_List", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!AST = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Private Sub CmdSaveRec_Click()
On Error GoTo Err_CmdSaveRec_Click
TxtLastUpdated.Value = Now()
TxtUpdatedBy.Value = CurrentUser()
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Exit_CmdSaveRec_Click:
Exit Sub
Err_CmdSaveRec_Click:
MsgBox Err.Description
Resume Exit_CmdSaveRec_Click
End Sub
Private Sub CSCCSA_AfterUpdate()
txtCSA_ID.Value = CSCCSA.Column(0)
txtCSA_Number.Value = CSCCSA.Column(2)
txtCSA_Email.Value = CSCCSA.Column(3)
End Sub
Private Sub CSCCSA_NotInList(NewData As String, Response As Integer)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strMsg As String
Dim CSA As AccessObject
strMsg = "'" & NewData & "' is not in our list. " & vbCrLf & vbCrLf
strMsg = strMsg & "Do you want to add " & NewData & " to the list? "
strMsg = strMsg & vbCrLf & vbCrLf & "Click Yes to add or No to re-type it.
"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Add new name?") = vbNo Then
Set db = CurrentDb
Set rs = db.OpenRecordset("TBL_CSA_List", dbOpenDynaset)
Response = acDataErrContinue
Else
Set db = CurrentDb
Set rs = db.OpenRecordset("TBL_CSA_List", dbOpenDynaset)
On Error Resume Next
rs.AddNew
rs!CSCCSA = NewData
rs.Update
If Err Then
MsgBox "An error occurred. Please try again."
Response = acDataErrContinue
Else
Response = acDataErrAdded
End If
End If
rs.Close
Set rs = Nothing
Set db = Nothing
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
TxtLastUpdated.Value = Now()
TxtUpdatedBy.Value = CurrentUser()
End Sub
Private Sub Form_Current()
txtCSA_ID.Value = CSCCSA.Column(0)
txtCSA_Number.Value = CSCCSA.Column(2)
txtCSA_Email.Value = CSCCSA.Column(3)
txtAsst_ID.Value = AST.Column(0)
txtCSA_Asst_Number.Value = AST.Column(2)
txtCSA_Asst_Email.Value = AST.Column(3)
End Sub
Private Sub Text94_AfterUpdate()
Me.Text94.Value = "FLE3.CGS.PN.ER" & Me.Text94.Value
End Sub
Private Sub txtCSA_Asst_Email_Click()
Dim SndEmail As String
SndEmail = "mailto:" & Me.[txtCSA_Asst_Email]
Application.FollowHyperlink Address:=SndEmail
End Sub
Private Sub txtCSA_Asst_Number_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FRM_NewAsst"
stLinkCriteria = "[Asst_ID]=" & Me![txtAsst_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
Private Sub txtCSA_Email_Click()
Dim SndEmail As String
SndEmail = "mailto:" & Me.[txtCSA_Email]
Application.FollowHyperlink Address:=SndEmail
End Sub
Private Sub txtCSA_Number_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "FRM_NewCSA"
stLinkCriteria = "[CSA_ID]=" & Me![txtCSA_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
Private Sub CmdRefresh_Click()
On Error GoTo Err_CmdRefresh_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, 5, , acMenuVer70
Exit_CmdRefresh_Click:
Exit Sub
Err_CmdRefresh_Click:
MsgBox Err.Description
Resume Exit_CmdRefresh_Click
End Sub
Can you post the code behind the Form and SubForm so we can take a look.
Daniel P
I am having trouble with data being erased in my form. It seems to be a bug,
or something. It only seems to be in this one subform. Not all the time,
[quoted text clipped - 7 lines]