startingover0001
New member
- Local time
- Today, 02:41
- Joined
- May 3, 2012
- Messages
- 7
I posted this on another forum and got no responses, so I'm hoping for a little bit better here.
I've searched the forum for this but so far what I've found does not apply in my case.
I have a main form with a close button on it, and a subform in continuous form with no close button on it. The problem is that after adding or editing a record on the subform, even after setting focus to the close button on the main form, I have to click the button twice to close the form. The first click always puts the cursor and focus back on a field in the subform. I've changes setting where the focus goes, but clicking on any control back on the main form simply places focus on the subform field again. There is no code here that should do this, and putting a break on the close button does not even get activated until you click it a second time. There's nothing in Current for either form to cause redirection nor any other place, but it is going someplace and I can't figure out how to find out what it's doing. Using the immediate and watch windows produces nothing. Any ideas?
The code for the main form is:
Private Sub cmdAdd_Click()
[fSetGuests1Sub].Form.AllowAdditions = True
[fSetGuests1Sub].SetFocus
[fSetGuests1Sub].Form![Arrival].SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub
Private Sub cmdEdit_Click()
[fSetGuests1Sub].Form.AllowEdits = True
[fSetGuests1Sub].SetFocus
[fSetGuests1Sub].Form![Arrival].SetFocus
DoCmd.GoToRecord , , acLast
End Sub
'------------------------------------------------------------
' cmdClose_Click
'
'------------------------------------------------------------
Private Sub cmdClose_Click()
DoCmd.Close , ""
End Sub
That's all the code there is on that form.
On my subform, the code is:
Private Sub Arrival_AfterUpdate()
Me.VisitingPeopleID = Forms![fSetGuests]![txtPeopleID_Tenant]
Me.Visiting = Forms![fSetGuests]![cboTenant].Column(4)
End Sub
Private Sub NumGuests_AfterUpdate()
If Me.Dirty Then Me.Dirty = False
'Me.AllowAdditions = False
'Me.AllowEdits = False
'Me.Requery
'Me.Refresh
Forms![fSetGuests1].SetFocus
Forms![fSetGuests1]![FName].SetFocus
Forms![fSetGuests1]![fSetGuests1Sub].Enabled = False
End Sub
Anything you see commented out is something different I've tried to eliminate the problem. No matter where you click on the main form, the detail, the close button or even another field, it always goes back to the subform's first field, usually in a new record.
I've searched the forum for this but so far what I've found does not apply in my case.
I have a main form with a close button on it, and a subform in continuous form with no close button on it. The problem is that after adding or editing a record on the subform, even after setting focus to the close button on the main form, I have to click the button twice to close the form. The first click always puts the cursor and focus back on a field in the subform. I've changes setting where the focus goes, but clicking on any control back on the main form simply places focus on the subform field again. There is no code here that should do this, and putting a break on the close button does not even get activated until you click it a second time. There's nothing in Current for either form to cause redirection nor any other place, but it is going someplace and I can't figure out how to find out what it's doing. Using the immediate and watch windows produces nothing. Any ideas?
The code for the main form is:
Private Sub cmdAdd_Click()
[fSetGuests1Sub].Form.AllowAdditions = True
[fSetGuests1Sub].SetFocus
[fSetGuests1Sub].Form![Arrival].SetFocus
DoCmd.GoToRecord , , acNewRec
End Sub
Private Sub cmdEdit_Click()
[fSetGuests1Sub].Form.AllowEdits = True
[fSetGuests1Sub].SetFocus
[fSetGuests1Sub].Form![Arrival].SetFocus
DoCmd.GoToRecord , , acLast
End Sub
'------------------------------------------------------------
' cmdClose_Click
'
'------------------------------------------------------------
Private Sub cmdClose_Click()
DoCmd.Close , ""
End Sub
That's all the code there is on that form.
On my subform, the code is:
Private Sub Arrival_AfterUpdate()
Me.VisitingPeopleID = Forms![fSetGuests]![txtPeopleID_Tenant]
Me.Visiting = Forms![fSetGuests]![cboTenant].Column(4)
End Sub
Private Sub NumGuests_AfterUpdate()
If Me.Dirty Then Me.Dirty = False
'Me.AllowAdditions = False
'Me.AllowEdits = False
'Me.Requery
'Me.Refresh
Forms![fSetGuests1].SetFocus
Forms![fSetGuests1]![FName].SetFocus
Forms![fSetGuests1]![fSetGuests1Sub].Enabled = False
End Sub
Anything you see commented out is something different I've tried to eliminate the problem. No matter where you click on the main form, the detail, the close button or even another field, it always goes back to the subform's first field, usually in a new record.