Hello Damion, I posted the code for my main form and subform as requested.
It's alot of code, sorry.
Let me know if you're able to help today. Thanks a million, Rob
**********************************************************
'---------------------------------------------------------------------------------------
' Module : Form_frmPtDemographicNew
' DateTime : 1/31/2007 08:52
' Author : Rob
' Purpose : Main Form for Patient Area
'---------------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Private Sub Form_Current()
On Error GoTo Form_Current_Error
Me.frmVisitNewEdit.Form.lstVisit.SetFocus
On Error GoTo 0
Exit Sub
Form_Current_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Form_Current of VBA Document Form_frmPtDemographicNew"
End Sub
Private Sub Form_Load()
On Error GoTo Form_Load_Error
Me.Form.AllowEdits = False
On Error GoTo 0
Exit Sub
Form_Load_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Form_Load of VBA Document Form_frmPtDemographicNew"
End Sub
Private Sub cmdSwitchBoard_Click()
On Error GoTo Err_cmdSwitchBoard_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "UCSD-EPIS"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmPtDemographicNew"
Exit_cmdSwitchBoard_Click:
Exit Sub
Err_cmdSwitchBoard_Click:
MsgBox Err.Description
Resume Exit_cmdSwitchBoard_Click
End Sub
Private Sub cmdPtDemGoToSearch_Click()
On Error GoTo Err_cmdPtDemGoToSearch_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmSearch"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdPtDemGoToSearch_Click:
Exit Sub
Err_cmdPtDemGoToSearch_Click:
MsgBox Err.Description
Resume Exit_cmdPtDemGoToSearch_Click
End Sub
Private Sub Form_Open(Cancel As Integer)
Me.AllowEdits = False
End Sub
*****************************************************************
'---------------------------------------------------------------------------------------
' Module : Form_frmVisitNewEdit
' DateTime : 1/31/2007 08:56
' Author : Robert Cass
' Purpose : Sub to PtDemographicNew, all visit actions are tied to the
VisitNo field
'---------------------------------------------------------------------------------------
Option Compare Database
Option Explicit
Private Sub cmdVisitEdit_Click()
On Error GoTo cmdVisitEdit_Click_Error
Me.Form.AllowEdits = True
On Error GoTo 0
Exit Sub
cmdVisitEdit_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
cmdVisitEdit_Click of VBA Document Form_frmVisitNewEdit"
End Sub
Private Sub Form_Current()
On Error GoTo Form_Current_Error
Me.Refresh
Me.lstVisit.SetFocus
Dim T_Visit As String
'T_Visit = Me.fldVisitType
T_Visit = Nz(Me.fldVisitType, "")
'first hide all controls
Me.pgAblations.Visible = False
Me.pgCardioversions.Visible = False
Me.pgClinicVisits.Visible = False
Me.pgDevices.Visible = False
Me.pgTilts.Visible = False
Me.pgTelephone.Visible = False
'now show one control
Select Case T_Visit
Case "Ablation"
Me.pgAblations.Visible = True
Case "Device"
Me.pgDevices.Visible = True
Case "Clinic"
Me.pgClinicVisits.Visible = True
Case "Cardioversion"
Me.pgCardioversions.Visible = True
Case "Telephone"
Me.pgTelephone.Visible = True
Case "Tilt Table"
Me.pgTilts.Visible = True
End Select
Me.lstVisit.SetFocus
On Error GoTo 0
Exit Sub
Form_Current_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Form_Current of VBA Document Form_frmVisitNewEdit"
End Sub
Private Sub Form_Load()
On Error GoTo Form_Load_Error
Me.AllowEdits = False
Me.lstVisit.SetFocus
On Error GoTo 0
Exit Sub
Form_Load_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
Form_Load of VBA Document Form_frmVisitNewEdit"
End Sub
Private Sub lstVisit_Click()
On Error GoTo lstVisit_Click_Error
Me.Filter = "VisitNo = " & Me.lstVisit.Value
Me.FilterOn = True
On Error GoTo 0
Exit Sub
lstVisit_Click_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
lstVisit_Click of VBA Document Form_frmVisitNewEdit"
End Sub
Private Sub cmdVisitNew_Click()
On Error GoTo Err_cmdVisitNew_Click
Me.Form.AllowEdits = True
DoCmd.GoToRecord , , acNewRec
Me.DTPicker7.Value = Date
Me.DTPicker7.SetFocus
Exit_cmdVisitNew_Click:
Exit Sub
Err_cmdVisitNew_Click:
MsgBox Err.Description
Resume Exit_cmdVisitNew_Click
End Sub
Private Sub cmdSaveVisit_Click()
On Error GoTo Err_cmdSaveVisit_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.Refresh
Me.Form.AllowEdits = False
With Me.[lstVisit]
.Requery
.Value = Me.[VisitNo]
End With
Exit_cmdSaveVisit_Click:
Exit Sub
Err_cmdSaveVisit_Click:
MsgBox Err.Description
Resume Exit_cmdSaveVisit_Click
End Sub
Private Sub cmdEchoOpen_Click()
On Error GoTo Err_cmdEchoOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmEcho"
stLinkCriteria = "[fldPINo]=" & Me![PINo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdEchoOpen_Click:
Exit Sub
Err_cmdEchoOpen_Click:
MsgBox Err.Description
Resume Exit_cmdEchoOpen_Click
End Sub
Private Sub lstVisit_MouseMove(Button As Integer, Shift As Integer, X As
Single, Y As Single)
On Error GoTo lstVisit_MouseMove_Error
Me.AllowEdits = True
On Error GoTo 0
Exit Sub
lstVisit_MouseMove_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
lstVisit_MouseMove of VBA Document Form_frmVisitNewEdit"
End Sub
Private Sub PINo_Change()
On Error GoTo PINo_Change_Error
Me.Refresh
On Error GoTo 0
Exit Sub
PINo_Change_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
PINo_Change of VBA Document Form_frmVisitNewEdit"
End Sub
Private Sub cmdAFibOpen_Click()
On Error GoTo Err_cmdAFibOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAblationAFib"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdAFibOpen_Click:
Exit Sub
Err_cmdAFibOpen_Click:
MsgBox Err.Description
Resume Exit_cmdAFibOpen_Click
End Sub
Private Sub cmdAVRTopen_Click()
On Error GoTo Err_cmdAVRTopen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAblationAVRT"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdAVRTopen_Click:
Exit Sub
Err_cmdAVRTopen_Click:
MsgBox Err.Description
Resume Exit_cmdAVRTopen_Click
End Sub
Private Sub cmdAVNRTopen_Click()
On Error GoTo Err_cmdAVNRTopen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAblationAVNRT"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdAVNRTopen_Click:
Exit Sub
Err_cmdAVNRTopen_Click:
MsgBox Err.Description
Resume Exit_cmdAVNRTopen_Click
End Sub
Private Sub cmdAVNodeOpen_Click()
On Error GoTo Err_cmdAVNodeOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAblationAVnode"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdAVNodeOpen_Click:
Exit Sub
Err_cmdAVNodeOpen_Click:
MsgBox Err.Description
Resume Exit_cmdAVNodeOpen_Click
End Sub
Private Sub cmdAFlutterOpen_Click()
On Error GoTo Err_cmdAFlutterOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAbaltionAFlutter"
stLinkCriteria = "[fldlVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdAFlutterOpen_Click:
Exit Sub
Err_cmdAFlutterOpen_Click:
MsgBox Err.Description
Resume Exit_cmdAFlutterOpen_Click
End Sub
Private Sub cmdSVTIopen_Click()
On Error GoTo Err_cmdSVTIopen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAblationVTSishcemic"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdSVTIopen_Click:
Exit Sub
Err_cmdSVTIopen_Click:
MsgBox Err.Description
Resume Exit_cmdSVTIopen_Click
End Sub
Private Sub cmdAblSVTdmOpen_Click()
On Error GoTo Err_cmdAblSVTdmOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAblationVTSdc"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdAblSVTdmOpen_Click:
Exit Sub
Err_cmdAblSVTdmOpen_Click:
MsgBox Err.Description
Resume Exit_cmdAblSVTdmOpen_Click
End Sub
Private Sub cmdVisitCancel_Click()
On Error GoTo Err_cmdVisitCancel_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
Me.Refresh
Exit_cmdVisitCancel_Click:
Exit Sub
Err_cmdVisitCancel_Click:
MsgBox Err.Description
Resume Exit_cmdVisitCancel_Click
End Sub
Private Sub cmdPMHopen_Click()
On Error GoTo Err_cmdPMHopen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPMHnew"
stLinkCriteria = "[fldPINO]=" & Me![PINo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdPMHopen_Click:
Exit Sub
Err_cmdPMHopen_Click:
MsgBox Err.Description
Resume Exit_cmdPMHopen_Click
End Sub
Private Sub cmdVisitStaff_Click()
On Error GoTo Err_cmdVisitStaff_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmVisitStaff"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdVisitStaff_Click:
Exit Sub
Err_cmdVisitStaff_Click:
MsgBox Err.Description
Resume Exit_cmdVisitStaff_Click
End Sub
Private Sub cmdClinicalPresentation_Click()
On Error GoTo Err_cmdClinicalPresentation_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmClinicalPresentation"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdClinicalPresentation_Click:
Exit Sub
Err_cmdClinicalPresentation_Click:
MsgBox Err.Description
Resume Exit_cmdClinicalPresentation_Click
End Sub
Private Sub cmdVitals_Click()
On Error GoTo Err_cmdVitals_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmVitals3"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdVitals_Click:
Exit Sub
Err_cmdVitals_Click:
MsgBox Err.Description
Resume Exit_cmdVitals_Click
End Sub
Private Sub cmdActHeparin_Click()
On Error GoTo Err_cmdActHeparin_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmACT"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdActHeparin_Click:
Exit Sub
Err_cmdActHeparin_Click:
MsgBox Err.Description
Resume Exit_cmdActHeparin_Click
End Sub
Private Sub cmdComplications_Click()
On Error GoTo Err_cmdComplications_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmComplicationsAbl"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdComplications_Click:
Exit Sub
Err_cmdComplications_Click:
MsgBox Err.Description
Resume Exit_cmdComplications_Click
End Sub
Private Sub cmdCharges_Click()
On Error GoTo Err_cmdCharges_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmVisitCharges"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdCharges_Click:
Exit Sub
Err_cmdCharges_Click:
MsgBox Err.Description
Resume Exit_cmdCharges_Click
End Sub
Private Sub cmdVTIdiopathicOpen_Click()
On Error GoTo Err_cmdVTIdiopathicOpen_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmAblationVTI"
stLinkCriteria = "[fldVisitNo]=" & Me![VisitNo]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_cmdVTIdiopathicOpen_Click:
Exit Sub
Err_cmdVTIdiopathicOpen_Click:
MsgBox Err.Description
Resume Exit_cmdVTIdiopathicOpen_Click
End Sub
****************************************************************