-
Can someone tell me what's wrong with this code and why it doesn't update the database?
Private Sub cmdPicture_Click()
Dim sFile As String
Dim db As Database
Dim rs As Recordset
With dlgCommonDialog
.DialogTitle = "Open"
.CancelError = False
.Filter = "BMP Files (*.BMP)|*.BMP"
.ShowOpen
sFile = .FileName
End With
frmMembers.Image1.Picture = LoadPicture(sFile)
frmMembers.lblPicturePath.Caption = sFile
Set db = OpenDatabase(App.Path & "\Members.mdb")
Set rs = db.OpenRecordset("MemberInfo", dbOpenDynaset)
rs.Edit
rs!PicturePath = sFile
Recordset("PicturePath") = Text1.Text
rs.Update
End Sub
GiD
-
Looks alright but maybe its because in this line
rs!PicturePath = sFile
you've put a ! instead of a . try
rs.PicturePath = sFile
:) Hope this works :)
------------------
Quadrex
[email protected]
Quadrex Programming
-
Nope that didn't do it....can anyone out there help out? I just can't seem to get the database to update? I keep getting an error that says the database is readonly but its not. I've checked!
GiD
-
Check the actual Read Attribute in the MDBs File Properties, could be it was left checked after a previous program crash?
Another possibility is that you have the DB open in something else and it's opened Exclusively.
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Hi,GiD.
Do you use ODBC? I had the same problem and I found on microsoft support page solution, you have to provide all 4 parameters in OpenRecordset.
Set rst=db.OpenRecordset _("TableName",dbOpenDynamic,0,dbOptimistic)
NOTE: You must supply a zero (0) for the Option argument.
Hope it help.
Larisa