I think the answer is simple. The tilda is a special character and you
would need to replace a single tilda with two tildas
From
FileName = Range("cnp_source").Value
FileName = Replace(FileName, ".dbf", "")
To
FileName = Range("cnp_source").Value
FileName = Replace(FileName, ".dbf", "")
FileName = Replace(FileName, "~", "~~")
You can also simplify your SQL a little bit like this
From
SQLQuery = "SELECT *" & Chr(13) & "" & Chr(10) & "FROM " &
FileName & " " & FileName & "" & Chr(13) & "" & Chr(10) & "WHERE " &
FileName & ".time = ' 0'" & Chr(13) & "" & Chr(10) & "ORDER BY
" & FileName & ".product, " & FileName & ".purpose, " & FileName &
".group"
To
SQLQuery = "SELECT *" & vbcrlf & "FROM " &
FileName & " " & FileName & "" & vbcrlf & "WHERE " &
FileName & ".time = ' 0'" & vbcrlf & "ORDER BY
" & FileName & ".product, " & FileName & ".purpose, " & FileName &
".group"
Why do you have the File name twice on the 2nd line?
--
joel
------------------------------------------------------------------------
joel's Profile:
http://www.thecodecage.com/forumz/member.php?userid=229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=158796
Microsoft Office Help