SetFocus strange problem

R

RobUCSD

I have a form called frmVisitsNewEdit with a listbox control called lstVisit.
In the form Load event and the form's Current event have the following;
Me.lstVisit.SetFocus. This works when the form loads, but when the record set
changes lstVisit sometimes gets the focus and sometimes not. I've tried
puting Me.lstVisit.SetFocus in the OnDirty event with the same results. My
frmVisitsNewEdit is a sub form to frmPtDemographics form. Maybe I need to
call the set focus for the list in the on current event of this form, but I'm
not sure how to set the focus for a control from a different form the control
is on.

As always, any help would be greatly appreciated.

Thanks, Robert
 
D

Damian S

Hi RobUCSD,

Put the me.lstVisit.Setfocus in the On Current event for your form. This
will return the focus to the listbox every time the record changes.

Hope this helps.

Damian.
 
R

RobUCSD

Damian, thanks for your response. I have tried this and I get the same
results, sometimes the focus is on the listbox and sometimes not. Any ideas?

thanks, rob
 
D

Damian S

Ah, I see... you also need to have it in the On Current event of your main
form, referencing the subform like this:

me.SUBFORMNAME.form.lstVisit.Setfocus

Sorry about that - I must have glossed over the bit about the subform...

Damian.
 
R

RobUCSD

Believe it or not, the problem still exist. Intermittent compliance with the
on current set focus to control. I don't get it. Thank for your help, if you
have any more ideas I'll try them.

Thanks, Robert
 
D

Damian S

Hi Rob,

It's home time now, but if you paste your code from your main form and
subform I will have a look at it in the morning...

Damian.
 
R

RobUCSD

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

****************************************************************
 
D

Damian S

Good morning Rob...

I have had a look at your code... On the surface it seems to be alright,
however I can offer the following to try:
1. You generally don't need to call me.refresh just because you have forced
a save or undo, so you could get rid of those for now.
2. You are setting the focus to the listbox in 3 different places - try
removing it from teh form load and form open events - the form current should
suffice
3. You are setting the focus to the date picker when you click the new
button, but because the on current event is setting it back to the listbox it
might be causing confusion... you could use the following code in your on
current to handle this:
if isnull(me.IDFIELD) then
me.DATEPICKER.setfocus
else
me.LISTBOX.setfocus
end if

Because when you commence a new record, the on current event is triggered
AND the IDFIELD will be null. Of course, you need to use the proper field
names where there are caps.

See how that goes!!

D.

RobUCSD said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top