[AccessD] Setting focus to a field on a subform

Charlotte Foust cfoust at infostatsystems.com
Thu Aug 7 13:47:16 CDT 2003


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


More information about the AccessD mailing list