Hi,
I'm not very familiar with
VB and ACCESS 2003, I have created a database with a field in wich I can load a binary file. After I've selected the file (browse) I have a button SAVE wich will get the file and save it in the field. The problem I have is:
if I'm using it I'm always updating the file from the 1st recordset. Even if I'm in the 3rd recordset, the file is applied to the 1st one.
So how can I specify to use the CURRENT RECORDSET.
My save button code is:
Private Sub cmdSave_Click()
On Error GoTo err
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strFileName As String
Set db = CurrentDb
Set rst = db.OpenRecordset("tblData")
'check a file path was entered
If getFileName(txtPath.Value) <> "" Then 'see modGlobals for getFileName function
'next check file exists
If fileExists(txtPath.Value, getFileName(txtPath.Value)) Then 'see modGlobals for fikeExists function
'THE SET CURRENT RECORD CODE GOES HERE ????
'rst.AddNew 'prepare recordset for a new record
If ReadBLOB(txtPath.Value, rst, "file") = 1 Then 'stores the binary data see modBlob for ReadBLOB function
rst!filename = getFileName(txtPath.Value) 'store the filename
rst.Update 'update the record
MsgBox "Success!", vbInformation
Else
MsgBox "Failed!", vbExclamation
End If
Else
MsgBox "Specified file does not exist!", vbExclamation
End If
rst.Close
db.Close
End If