PC Review


Reply
Thread Tools Rate Thread

Set field focus in a subroutine

 
 
gaugust
Guest
Posts: n/a
 
      23rd Apr 2010
In Access 2003 (Windows XP) I am passing the value of a field in a textbox on
a form to a subroutine to validate that the date value is within a range. If
the date is out of range I would like to set the focus of the field on the
form and display an error message. When I pass in the field to the
subroutine, I get a compile error "Invalid qualifier" when I try to set focus
to the date field. How can I set the focus to the field within the
subroutine. Here is the subrotuine code:

Public Sub CheckDates(date1 As Date)
If Not IsNull(date1) And date1 < [Forms]![frmMRA]![frmSectionA -
1].Form![date_of_admission].Value Then
MsgBox "The date must be on or after the hospital admission date",
vbOKOnly, "Date out of range"
Cancel = True
date1.SetFocus
End If
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call a subroutine using variable subroutine name dhstein Microsoft Excel Misc 3 26th Jul 2009 08:28 PM
How To Quit Subroutine from a called subroutine =?Utf-8?B?UmljaCBK?= Microsoft Excel Programming 4 20th Feb 2007 07:48 PM
Passing a subroutine as a parameter to another subroutine =?Utf-8?B?UmljaGFyZCBHcmFudA==?= Microsoft VB .NET 7 18th Feb 2004 05:09 PM
Re: Subroutine within a Subroutine Alex K. Angelopoulos [MVP] Microsoft VB .NET 1 20th Jan 2004 07:39 PM
How to pass a subroutine as a parameter to another subroutine? Richard Microsoft VB .NET 2 15th Jan 2004 08:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:58 PM.