path map error

L

LJG

Hi Guys,

Am having a problem with some code, I have included this path in the code:

strSS = "C:\database\appointments\appointment_" _
& "*" & rst.Fields("User Name") & ".xls" 'the name of the
Field

Yet when I run this code I get an error message stating that it is looking
for a file path of C:\reliable

if I run in the code in the immediate the response's are:

?strSS
C:\database\appointments\appointment_*Les.xls

?strTransfer
Appointment_173_Les.xls

I do have a folder C:\reliable but have no mention of it within my code??

Any suggestions would be appreciated.

TIA
Les

Code >>>>>>>

Function newAppoint()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSS As String
Dim strTransfer As String

If MsgBox("You are about to import a new appointment, " & _
"Do you wish to continue?. ", vbYesNo) = vbYes Then
DoCmd.SetWarnings False
Set db = CurrentDb
Set rst = db.OpenRecordset("tblUser") 'the name of the table
If rst.RecordCount = 0 Then
MsgBox "No Records To Process"
End If
rst.MoveLast
rst.MoveFirst
Do Until rst.EOF
strSS = "C:\database\appointments\appointment_" _
& "*" & rst.Fields("User Name") & ".xls" 'the name of the
Field
strTransfer = Dir(strSS)
Do While strTransfer <> "" ' Start the loop.
DoCmd.TransferSpreadsheet acImport, 8, "tempAppointments",
_
strTransfer, True, ""
strTransfer = Dir
Loop
rst.MoveNext
Loop
rst.Close
Set rst = Nothing
Set db = Nothing
Call MsgBox("Your new appointments have been added", vbExclamation,
Application.Name)
End If
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top