Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Set Focus Not working on a form

I have a form that onlost focus of txtBadgID executes the following
code:

Private Sub txtBadgeID_AfterUpdate()

strEmpID = DLookup("[id]", "tblEmployee", "[BadgeID] =
forms!frmSave!checkedoutby")
If IsNull(strEmpID) Then
MsgBox "Badge Not Found, Enter Employee then Proceed!",
vbCritical, "Equipment Check Out"
Me.txtBadgeID.Value = ""
Me.txtBadgeID.SetFocus
Exit Sub
End If
Me.Employee_ID.Value = strEmpID
Me.Equipment_ID.Value = Forms!frmScanLocation.txtEquipmentID
Me.CheckedOut.Value = True
DoCmd.Close
Forms!frmScanLocation.Visible = True
Forms!frmScanLocation.txtScanLoc.Value = ""

End Sub

My problem is that txtBadgID is not gaining focus if strEmpID isNull
(the first if Statement. Any Ideas? It then line
me.txtBadgeID.Setfocus should work... The line me.txtBadgeID.Value = ""
does in face clear the text box from all text.. Any thoughts?

Thanks,

Dave

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Set Focus Not working on a form

I followed this instructions and it worked. the msgbox was coming up
but the set focus wasnt working

found the fix at this post..
http://groups.google.com/group/micro...ab1e7b475573d3

Thanks,

Dave


Alok wrote:
Sorry, change
If isnull(strEmpID) then to
If strEmpID="" then
Alok

" wrote:

I have a form that onlost focus of txtBadgID executes the following
code:

Private Sub txtBadgeID_AfterUpdate()

strEmpID = DLookup("[id]", "tblEmployee", "[BadgeID] =
forms!frmSave!checkedoutby")
If IsNull(strEmpID) Then
MsgBox "Badge Not Found, Enter Employee then Proceed!",
vbCritical, "Equipment Check Out"
Me.txtBadgeID.Value = ""
Me.txtBadgeID.SetFocus
Exit Sub
End If
Me.Employee_ID.Value = strEmpID
Me.Equipment_ID.Value = Forms!frmScanLocation.txtEquipmentID
Me.CheckedOut.Value = True
DoCmd.Close
Forms!frmScanLocation.Visible = True
Forms!frmScanLocation.txtScanLoc.Value = ""

End Sub

My problem is that txtBadgID is not gaining focus if strEmpID isNull
(the first if Statement. Any Ideas? It then line
me.txtBadgeID.Setfocus should work... The line me.txtBadgeID.Value = ""
does in face clear the text box from all text.. Any thoughts?

Thanks,

Dave



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Form - Text Box Focus ceemo[_27_] Excel Programming 1 August 30th 05 07:50 PM
set focus on user form jhahes[_2_] Excel Programming 1 June 1st 05 09:26 PM
Form Focus and SelStart Geoff[_9_] Excel Programming 0 April 4th 05 07:20 PM
User Form focus Glen Mettler[_2_] Excel Programming 3 October 10th 04 05:31 PM
Sending Form Focus? Clint K. Excel Programming 0 May 23rd 04 03:16 AM


All times are GMT +1. The time now is 11:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"