I'm not exactly sure where the difficulty is. I mocked up a situation that seems similar (to me anyway)
I created a table called Load_info_Local
FileId |
LN |
MyName |
1 |
traffic.xml |
jed |
2 |
xmlCars.xml |
Sammy |
3 |
DenmarkBank.xml |
Gustav |
And modified your procedure as follows
Code:
Function Loan_Folder_Search3()
Dim rs As DAO.Recordset
Dim LN As String
Dim Client_Name As String
Dim RetVal As String
Dim LFPath As String
' Set rs = CurrentDb.OpenRecordset("SELECT ID, LN, Client_Name FROM [Loan_Info_local]")
' LN = rs![LN]
' Client_Name = rs![Client_Name]
Set rs = CurrentDb.OpenRecordset("SELECT FileID, LN,MyName FROM [Loan_Info_local]")
Do While Not rs.EOF
LN = rs!LN
Client_Name = rs!MyName
'Case "Bank of David, N.A."
' LFPath = "\\MAXSERVER\Max Default\BOD\"
' RetVal = Shell("explorer.exe " & LFPath & LN, vbNormalFocus)
Select Case Client_Name
Case "Sammy"
LFPath = "C:\Documents and Settings\Garay\My Documents\"
RetVal = Shell("notepad.exe " & LFPath & LN, vbNormalFocus)
Case Else
End Select
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Function
I just happened to be working on an XML file, when I used explorer.exe it gave me a warning message so I chose NotePad.exe to open the xml file without issue.
I did put the process inside a Do Loop to get to another record ie not the first record.
Is it possible you chose to use Select case instead of an IF? I'm not sure how you would get past the first record.
Then again, I may have misunderstood your issue.