Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2005

Tip: Looking for answers? Try searching our database.

Set focus

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
NNlogistics - 29 Mar 2005 23:05 GMT
I seem to have so much trouble with set focus.  Does it trouble anyone else?  
Maybe I dont understand what it does or maybe its the if /then I am using.  I
have a very simple pop up form. it has 2 enties and I want to be sure that
there is data in those fields before I close the form.
If it detects a null,  want it to stop and wait for input at the txtbox.  It
doesn't, it just closes form.  My guess is the if/then not the set focus but
I hope I will get other opinions.

Private Sub cmdToClosefrmRepairComplete_Click()
On Error GoTo Err_cmdToClosefrmRepairComplete_Click
If IsNull(txtDateRepairComplete) Then
   MsgBox (" You must have an Entry in 'Date Repair Complete'")
   Me.txtDateRepairComplete.SetFocus
   
End If
   

   DoCmd.Close

Exit_cmdToClosefrmRepairComplete_Click:
   Exit Sub

Err_cmdToClosefrmRepairComplete_Click:
   MsgBox Err.Description
   Resume Exit_cmdToClosefrmRepairComplete_Click
   
End Sub

I
Signature

Thanks for any assistance

Ken Snell [MVP] - 29 Mar 2005 23:17 GMT
Put an Exit Sub step right after the SetFocus step. Your code currently sets
the focus and then continues to the Close step.

If IsNull(txtDateRepairComplete) Then
   MsgBox (" You must have an Entry in 'Date Repair Complete'")
   Me.txtDateRepairComplete.SetFocus
   Exit Sub
End If
Signature


       Ken Snell
<MS ACCESS MVP>

>I seem to have so much trouble with set focus.  Does it trouble anyone
>else?
[quoted text clipped - 28 lines]
>
> I
NNlogistics - 30 Mar 2005 00:35 GMT
Thanks Ken

> Put an Exit Sub step right after the SetFocus step. Your code currently sets
> the focus and then continues to the Close step.
[quoted text clipped - 36 lines]
> >
> > I
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.