UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Set Focus Problem    
 
   
dashiellx2000
post Sep 9 2005, 07:31 AM
Post #1

UtterAccess VIP
Posts: 9,209
From: Maryland



I'm pulling my hair out over this, but can anyone tell me why my set focus command isn't working?

QUOTE
If Me.DateOfService >= Date Then
MsgBox "The Service Date Must be less then today's date!", vbCritical, "DateError"
Me.DateOfService = Null
[Forms]![frmMARefundEntry]![DateOfService].SetFocus
End If


I originally tried just he Me.DateOfService.SetFocus, but that didn't work so I tried the full identification.

Thanks.
Go to the top of the page
 
+
fkegley
post Sep 9 2005, 08:02 AM
Post #2

UtterAccess VIP
Posts: 23,583
From: Mississippi



I would try this:

CODE
If CDate(Me.DateOfService) >= Date() Then
MsgBox "The Service Date Must be less then today's date!", vbCritical, "DateError"
Me.DateOfService = Null
[Forms]![frmMARefundEntry]![DateOfService].SetFocus
End If
Go to the top of the page
 
+
dashiellx2000
post Sep 9 2005, 08:24 AM
Post #3

UtterAccess VIP
Posts: 9,209
From: Maryland



Thanks Frank. But that didn't work.

One think I know my version of A97 does is when I type Date() in VBA it changes it to Date. Would this have anything to do with it???

Thanks.
Go to the top of the page
 
+
fkegley
post Sep 9 2005, 08:51 AM
Post #4

UtterAccess VIP
Posts: 23,583
From: Mississippi



If it is doing it itself, then that is not the problem.

Have you tried setting a break point and stepping through the code?

Just in case, open the code window, and click in the gray area to the left of the first line of the troubled procedure. You should see a brown red symbol. Then close the code window and switch to Form View. Do what you have to do to cause this code to go off. It should open the code window. The line about to be executed will be highlighted yellow. Press F8 to move through the lines. Rest the mouse pointer on the Me.DateOfService to see what it thinks is there.
Go to the top of the page
 
+
narbspot
post Sep 9 2005, 09:53 AM
Post #5

UtterAccess Veteran
Posts: 447
From: WI, USA



Suggestion- DateOfService isn't locked when you set the focus is it?. Also, Maybe the form is corrupt, just copy everything to a new one and see if that works. I honestly don't know what is causing the focus to not be set. Does Access not like the code or does it not set the focus?
Go to the top of the page
 
+
dashiellx2000
post Sep 9 2005, 12:28 PM
Post #6

UtterAccess VIP
Posts: 9,209
From: Maryland



Thanks Frank and Narb, but I just can't figure this out. The code does everything, but set the focus on the field. And it is only in this instance. I have other set focus commands on the form and they all work fine. I'm at a loss. I just made the field required so if they don't go back and manually enter it, when they attempt to close the form or goto a new record they have to go enter it.

Thanks.
Go to the top of the page
 
+
fkegley
post Sep 9 2005, 12:48 PM
Post #7

UtterAccess VIP
Posts: 23,583
From: Mississippi



William, I too am having trouble with why this is not working. I have noticed several times in my career that sometimes stuff just happens! You just have to work around it the best way you can.
Go to the top of the page
 
+
rkeifer
post Sep 9 2005, 01:47 PM
Post #8

UtterAccess Addict
Posts: 207
From: Atlantic City, NJ



Where is this code ? What event ?
Go to the top of the page
 
+
dashiellx2000
post Sep 9 2005, 02:25 PM
Post #9

UtterAccess VIP
Posts: 9,209
From: Maryland



It is on the after update event.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 21st May 2013 - 11:15 PM