JithuAccess
Member
- Local time
- Today, 11:21
- Joined
- Mar 3, 2020
- Messages
- 325
Hello Guys,
This is my Code
If a User leave the strID Field Blank, I don't want to Display any messages. But this is not working. Though I don't enter any value in the ID field on the Got Focus of strName I am getting the Message. Could you please let me know how to solve this.
Thanks
This is my Code
Code:
Private Sub strName_GotFocus()
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 Me.strID = Null Then
Exit Sub
End If
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
If a User leave the strID Field Blank, I don't want to Display any messages. But this is not working. Though I don't enter any value in the ID field on the Got Focus of strName I am getting the Message. Could you please let me know how to solve this.
Thanks