I really need to be able to store the file path into the Table I have called "ProductImages" Field "ProductImageLocalPath" as a new record.
When I try to bound the record source to the Table "ProductImages.ProductImageLocalPath" I get you can't assign a value to this object.
I know I need to have a bounded control and then go from that bounded control to a image control but I am not getting it!
Thank you!
Microsoft AccessVisual Basic.NET
Last Comment
Dustin Stanley
8/22/2022 - Mon
COACHMAN99
Is the form bound to the table and the text box
bound to a field in the table..
Dustin Stanley
ASKER
No the form is not bound to the table currently. I have just made a small test form to get it correct and then I was going to put it on a official form. But either way I do not think the control (Text box) will be bound either way.
When I make the textbox bound in the control source it gives the error.
Im not sure I understand fully but before you bind a control source to a control you have to bind the form to a recordsource.Once the form is bound the table fields will be available to choose from
Dustin Stanley
ASKER
I know I am confusing. Even to myself. Is there any way to bind the control text box to the recordsource without it giving me an error?
Can I bind it in any other way besides a direct form made from the table?
Say I put a random text box on a random form how would I bind it to the recordsource [ProductImages].[ProductImageLocalPath]?
COACHMAN99
If the form is unbound then you would use an Sql insert statement to add it to the table
Ok the problem there is I am wanting to display the image on the main entry form and it is bounded to my SKUs Table.
I want the image control and button to be here on this form in the red box. I need a button to go retrieve file path store it in my [ProductImages].[ProductImageLocalPath] record and display it on the Skus Form.
I just got some time so I will try some different things. I will also look at the attachment.
Thank you All for the help!
Dustin Stanley
ASKER
By the way I cant get the Zip to extract or open to view I just tried.
Yes.
this is to provide the image path to an unbound image control on any form, once the form is loaded (because you indicated you didn't want to bind this form and the main form to the table)
Dustin Stanley
ASKER
Ok I will see what I can do and get back with you. Thanks.
Dustin Stanley
ASKER
Ok So basically use a Dlookup for the image control Correct?
This will retrieve the filepath from the ProductImages Table and know what to display?
yes. if the stored path points to a valid image then it will display in the control once you have set the 'picture' property and refreshed the image (if it doesn't do it automatically)
the picture type should be 'linked'
Dustin Stanley
ASKER
Ok I think the real question is how can I get the function I am using to generate the file path into my ProductImages table field?
After that then the dlookup would work good.
I was just hoping there was a way to bind the text box to the table so when I generated the file path with the function and it went into the textbox it would then insert a new record into my table.
when you say reference I assume you want to update the database?
if the textbox isn't bound then you cannot update the table field directly.
you have to use the code I provided above to run an insert statement.
if the data already exists then you would run an UPDATE statement (vs INSERT)
Dustin Stanley
ASKER
Ok I see and yes I want to insert a new record. But when I insert anything into the textbox control source I get "You can't assign a value to this object." after I click the command button browse to my file and select my image.
COACHMAN99
you don't insert into the textbox control source if it isn't bound - you insert into the 'text' property.
Me!Text1 = GetFile_Browse
then you assign the image 'picture' property = textbox.text
I get the horrible feeling we are going around in circles here?
bound to a field in the table..