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

Continuous Form 1

Status
Not open for further replies.

lmcc007

Technical User
May 7, 2009
164
US
I have a imgPencil on a continuous form. OnCurrentEvent is set to:

If Me.txtActivityType = 22 Then
Me.imgPencil.Visible = True
Else
Me.imgPencil.Visible = False
End If

The above code works fine on a Single Form.

Is there a way to get it to work on a continuous form without displaying the image on all the records?

Thanks!
 
If you make one control visible, it will be visible for all records. If you want to display a pencil for records with txtActivityType =22, you can create a text box:
Control Source: =IIf([txtActivityType]=22,"!",Null)
Font: Wingdings
Locked: Yes
Enabled: No

Duane
Hook'D on Access
MS Access MVP
 
Thanks dhookom,

That's it.

Why doesn't the same code work with the image control?

Here is what I posted on the imgPencil control:

=IIf([txtActivityType]=22,
.[Visible]=True,Null)
 
That will not work on a contuous form. The display must either be bound to a field in the record source or you would need to use conditional formatting which I don't believe works for image controls or the visible property.

Did the wingding pencil work for you?

Duane
Hook'D on Access
MS Access MVP
 
Thanks Duane,

Since you explained it now it makes sense that "The display must either be bound to a field in the record source..."

Yes, the Wingding pencil works; it's just not the pencil image I downloaded from MS Clip Art--the coloring and size are perfect, but the Wingding pencil will do.
 
If you make a table with images (.bmp) you can link to them with a foreign key. With a little creativity you can create a junction table to use these throughout your application with other tables. You can then get something like:
16aznzp.jpg
 
Thanks MajP,

I was trying not to create any more tables and stuff--trying to keep it simple as possible. Duane's suggestions is working.
 
MajP,

Could I have some more info on how you do the example above.

I want to create a corporate directory and put a little flag next to the person to show which country they are in.

Regards,

John
 
Before doing this, what version of Access do you have? The reason is Access 2007 and beyond does a much, much better job of handling images. Approximately, how many flags would you store? Approximately, what size of image?

You have to store the images into a table, and with older Access versions this can bloat your database. But the concept is pretty simple

tblCountries
countryID (autonumber)
countryName (text field with the country name)
imgFlag (ole object)

Then in your person table you need a foreign key to "countryID_fk" which allows you to join to the country. On your form use a bound image control to display the flag.

You may have to store the flags as .bmp to render, but with Access 2007 they maybe can be stored in other formats and still render.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top