Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Const and Currenetproject.path

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
I appreciate the two do not go together
Having said that how can I accomplish the following with my code below

I need Const cstrFileName = Currenetproject.path & “\ “ & Currenetproject.name

Function ExtractBLOBAll() As Boolean
'Extracts specified BLOB to file from table tblBLOB

Dim strSQL As String
Dim rst As Object 'ADODB.Recordset
Dim strFileName As String
Const cstrFileName = "C:\Documents and Settings\WRITE\BLOBFile"
Set rst = CreateObject("ADODB.Recordset")
strSQL = "SELECT FileExt, BLOB FROM tblBLOB"
rst.Open strSQL, CurrentProject.Connection, 1, 3
Do Until rst.EOF
If Not IsNull(rst!FileExt) Then
strFileName = cstrFileName & rst.AbsolutePosition & "." & rst!FileExt
End If
WriteBinaryFile rst.Fields("BLOB").Value, strFileName
rst.MoveNext
Loop

CloseUp:
On Error Resume Next
rst.Close
Set rst = Nothing

End Function
 
Constants are, by definition, determined at compile time but things like "Currenetproject.path" and "Currenetproject.name" are not determined until run time.

You will need to

[blue]Dim cstrFileName As String[/blue]

and then set it to the specified concatenated string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top