Hello,
I want to perform following objectives using the code:
1. Initial string (Report No) is ABCD-EF/1122 (Rev.1)
2. First I want to truncate it to ABCD-EF/1122
3. Then I want to get ReportID in tblReports of the truncated Report No.
I am using following code:
It is not giving me required result. Where am I doing wrong.
Best Regards
I want to perform following objectives using the code:
1. Initial string (Report No) is ABCD-EF/1122 (Rev.1)
2. First I want to truncate it to ABCD-EF/1122
3. Then I want to get ReportID in tblReports of the truncated Report No.
I am using following code:
SQL:
Dim sReportNo as String
Dim lngReportNo as Long
sReportNo = CStr(me.txtNo) 'txtNo is equal to ABCD-EF/1122 (Rev.1)'
sReportNo = Left(sReportNo, Len(sReportNo) - InStrRev(sReportNo, " ")) 'ReportNumber is the field name in tblReports where report no are stored in either ABCD-EF/1122 or ABCD-EF/1122 (Rev.1) format'
lngReportNo = DLookup("ReportID", "tblReports", "ReportNumber =" & sReportNo)
It is not giving me required result. Where am I doing wrong.
Best Regards