[AccessD] Setting focus to a field on a subform

Wortz, Charles CWortz at tea.state.tx.us
Thu Aug 7 15:06:06 CDT 2003


John,

I haven't been following this thread so I may not be reading you
correctly.  You are in the subform and trying to pop up the message box
and then set the focus to the default location on the subform?  Why are
you not specifying a control on the subform that you want to get focus?
For debugging purposes I would add an Else clause with its own MsgBox to
make sure it is doing what you want it to do.

Charles Wortz
Software Development Division
Texas Education Agency
1701 N. Congress Ave
Austin, TX 78701-1494
512-463-9493
CWortz at tea.state.tx.us



-----Original Message-----
From: John Clark [mailto:John.Clark at niagaracounty.com] 
Sent: Thursday 2003 Aug 07 14:56
To: accessd at databaseadvisors.com
Subject: RE: [AccessD] Setting focus to a field on a subform

I have altered my code to the following:


If Not ((Me!sfrmSubConts.Form!chkCSE) Or (Me!sfrmSubConts.Form!chkCSI)
Or (Me!sfrmSubConts.Form!chk3B) Or (Me!sfrmSubConts.Form!chk3E)) Then
    MsgBox "You have no funding source selected.", vbOKOnly, "Funding
Source Error"
    Me!sfrmSubConts.SetFocus
    'Me!sfrmSubConts.Form!chkCSE.SetFocus
End If

The MsgBox line changed due to the help of the list, and I noticed my
validation code (i.e. the IF statement) didn't work as good as I had
thought...actually it worked too good, becasue it worked even when it
shouldn't have. It pops up the MsgBox at the correct times, but it still
does not set the focus...it goes to the next control on the parent form.


More information about the AccessD mailing list