JithuAccess
Member
- Local time
- Today, 00:45
- Joined
- Mar 3, 2020
- Messages
- 297
Hello Guys,
This is my Code
Here, I want to display the matching Records from the Main Table to my Form based on ID. It is working perfect. If I have entered an ID which is not in the Master Table, a Message Box is displaying BUT the Code Me.strID.SetFocus is not working. The Focus is going to the Next Text Box strName.
The Tab Index of strID is 0 and Tab Index of strName is 1 and Tab Stop properties of Both these Text boxes are True.
Could you please help me how to solve this?
Thanks
This is my Code
Code:
Private Sub strPHN_LostFocus()
Dim db As Database
Dim rst As Recordset
Dim STRSQL As String
Set db = CurrentDb()
STRSQL = "Select [tblMaster Table].[strID], [tblMaster Table].[strName],[tblMaster Table].[strKeywords],[tblMaster Table].[datMeeting Date],[tblMaster Table].[strStatus of Application] from [tblMaster Table] where [tblMaster Table].[strPHN]=" & "'" & Me.strPHN & "';"
Set rst = db.OpenRecordset(STRSQL)
If rst.RecordCount = 0 Then
MsgBox "This ID " & Me.strID & " Not Found in Master Table, Please check the ID", vbInformation
Me.strID.SetFocus
Exit Sub
End If
Me.strPHN = rst.Fields(1)
Me.strName = rst.Fields(2)
Me.strKeywords = rst.Fields(3)
Me.datMeeting_Date = rst.Fields(4)
Me.Recalc
End Sub
Here, I want to display the matching Records from the Main Table to my Form based on ID. It is working perfect. If I have entered an ID which is not in the Master Table, a Message Box is displaying BUT the Code Me.strID.SetFocus is not working. The Focus is going to the Next Text Box strName.
The Tab Index of strID is 0 and Tab Index of strName is 1 and Tab Stop properties of Both these Text boxes are True.
Could you please help me how to solve this?
Thanks