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

Form Background Picture

Status
Not open for further replies.

danilof

Technical User
Dec 3, 2002
8
GB
I want to allow a user to change the background picture of form in an mde file.
I've added a button that opens acommon dialogue box to select a picture file which is successfully returned and put in the form's .picture property (embedded):
Forms![main switchboard].picture = strFilename
or - me!.picture = strFilename

I then have 2 problems
i) The (stretched) picture appears ok if I have paused the code (by adding a breakpoint), but when I run it normally the picture doesn't appear on the form but part of it does appear on a strip along the bottom where the screen is bigger than the form in design view (if you get what I mean). Any ideas anyone?
ii) The other problem is that the path I have written to the picture property doesn't stay if I close the program down or go to design view and the whole thing reverts to the plain background. Is there any way I can make the change to the picture property 'permanent'?
Hopeful thanks.
 
To make the path permanent, you could store the path in a table... In the on_load_event- of the form you could check if there is path set for a picture, if so, use the path to display the picture, like:

Code:
Private Sub Form_Load()
    If IsNull(DLookup("[MemberName]", "[tblMembers]", "MemberId=" & 1)) = False Then
        Me.Picture = DLookup("[MemberName]", "[tblMembers]", "MemberId=" & 1)
    End If
End Sub

If you have more users then one, you could store the path in a users profile, so every user can select is own picture. In the user settings table you could store more 'formatting', like background colors, letter types and so on...


Pampers [afro]
Keeping it simple can be complicated
 
Thanks Pampers. I had thought of that but was trying to keep away from an additional table as I have an import facility to bring in old dB tables and its just another complication. Thought it should be simple to achieve but looks like i was wrong!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top