[AccessD] Setting focus to a field on a subform

John Clark John.Clark at niagaracounty.com
Thu Aug 7 14:01:37 CDT 2003


OK, this clears up why I thought I needed that "x =" bit, but why will
it not set the focus? I should have been a little more clear in my
post...the message box did appear...I just want the focus to set back.

>>> cfoust at infostatsystems.com 08/07/03 02:47PM >>>
You're using the MsgBox function syntax, but if you do it like this,
you
don't need a return value:

MsgBox "You have no funding source selected.", vbOKOnly, "Funding
Source
Error"

Charlotte Foust

-----Original Message-----
From: John Clark [mailto:John.Clark at niagaracounty.com] 
Sent: Thursday, August 07, 2003 10:42 AM
To: accessd at databaseadvisors.com 
Subject: [AccessD] Setting focus to a field on a subform


On a subform, I have four 'funding source' fields. Before the user
leaves this subform, I want to ensure that they have chosen at least
one
of these. If none of these are chosen, then I want to present a
message
box and bounce back to the subform...preferably to the first of the
fund
sources. I put the following code into the 'On Exit' event of the
subform control:

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


As you may notice, I have commented out the last line...it didn't work
on its own, and I also tried it along w/the previous line. 

Also, I haven't used message boxes too much, but I didn't think I
needed
the 'X =' that I apparently needed to include. 

Thanks 

John W Clark
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com 
http://databaseadvisors.com/mailman/listinfo/accessd 
Website: http://www.databaseadvisors.com 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com 
http://databaseadvisors.com/mailman/listinfo/accessd 
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list