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

image's control source

Status
Not open for further replies.

LARiot

Programmer
Feb 7, 2007
232
Hi folks. Any help is appreciated.

I'm trying to change the control source of an image in the VBA however it doesn't show up in the list/properties dropdown when I type in me.imgNarrative. The Control Source exists in the properties window on the form just not in the VBA.

Any clues as to why this is doing this?

Thanks

-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor
 
I'm using Access 2010.

-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor
 
So after some research it turns there's no Control Source for the vba! How can this be? What do you do when you have to change the control source to point to another field in a table? Am I crazy? What's going on?

[banghead]

-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor
 
I played with this and could not figure out a way to do this. The control source for the image control was added in Access 2007. Why they did not change the object model I do not know. could you fake this by adding a hidden image control? Then switch between the two making the hidden visible and the current invisible.
 
LARiot,
You haven't suggested what happened when you simply ignored the fact that ControlSource didn't display in the Intellisense and typed it regardless?

I believe the PageBreak control never displayed the Visible property in Intellisense but that didn't prohibit you from using it in VBA.

Duane
Hook'D on Access
MS Access MVP
 
Says member or property not found.

-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor
 
A record has four images associated with it. Four option buttons on top of the image in the form. When you select one button it should change the source control for that image to point to the corresponding field/column.

-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor
 
Have four bound image controls stacked on top of each other and bound to different fields. Hide all but one. Change which one is the visible control. However, this does not seem very normalized. Seems to me you should have a table of images with a foreign key relating to the record instead of separate fields for each image. Then you could simply scroll through the available records. If the data cannot be permanently normalized you could use a normalizing query with the form.
 
As posted in the other thread the easier solution would be to go back to leave the image control unbound and use code to load it. Example. Assume I have 3 fields: path1, path2, and path3. And have command buttons to change the image. Then simply need some code like
Code:
Private Sub Command1_Click()
  Me.Image0.Picture = Me.path
End Sub

Private Sub Command2_Click()
  Me.Image0.Picture = Me.path2
End Sub

Private Sub Command3_Click()
  Me.Image0.Picture = Me.path3
End Sub
Need to add error checking for bad paths, and null records.
 
Maj:

I'd already thought of that. No go, another M$ bug. Had to code it to change text field in table.

Thanks for lookin' into it.


-Nima
"Pluralitas non est ponenda sine necessitate", i.e., "Plurality is not to be posited without necessity" aka K.I.S.S. (Keep It Short and Simple) -- Ockham's Razor
 
I have tried that in 2007 and 2010 and works fine. I know of no bug associated with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top