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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save picture or picture path to table?

Status
Not open for further replies.

Ciralia

Programmer
Oct 22, 2002
51
US
I have a form that allows the user to browse their computer and open a picture. I have a button that they press to display the picture they chose, and with that button I want to save the picture's path/filename to a table called tblPhoto. So far I have this:

Me.Photo = txtPath.Value 'save path name from text box

This works for only a first record, as it overwrites itself if done more than once. How do I insert a new record every time a different picture is displayed? I tried doing a recordset and have failed lol.
 
you could try using me!YrFld.oldvalue i.e.

if me!yrFld.oldvalue <> me!yrFld then
...... Yr code
end if

Herman


 
When I put that coding into my form, nothing is saved to the table at all. Here is the code:

imgTest.Picture = txtPath.Value 'change image on form

If Me!Photo_OldValue <> Me!Photo_OldValue Then

Me.Photo = txtPath.Value 'save photo path/filename in tblPhoto

End If


Also, what is the difference between using the exclamation point and a period?
 
The old Bank - Dot problem :)

The dot is internal ref to objects in access
The bang is a ref to your own objecte in access

Herman
 
If the path name I want to save is in a text box called txtPath, and my table that contains the Text field called Path, how would I get that text box value to save into the table. I am also using ID numbers to distinguish records from one another, so I think I many need to use that too.

Something I did try was:

Me.Photo = txtPath.Value

But it gave me an error that the recordset could not be updated even though there are no record locks on the query it is connected to.
 
You use Me.Photo = txtPath.Value
but this should be Me!Photo = me!txtPath I think

Herman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top