Form not redrawing properly in Access 2010 (1 Viewer)

MostlyFrustrated

New member
Local time
Today, 14:23
Joined
Oct 9, 2012
Messages
9
First of all, though I've been doing light programming with VB and other languages for years, I'm not an experienced Access developer. My apologies ahead of time if this is an elementary issue, but I wasn't able to find anything on this forum or on Google that was pertinent.

I have a switchboard form that contains primarily buttons for database users to click, but it does have a few text fields and labels that update their values during the form's On Open event, as well as when selected buttons are clicked. In only one case (one button) I included Me.Repaint because I found I didn't really need it in other cases ... everything on the form was refreshing properly without using it. The On Open event includes a DoCmd.Maximize statement. I don't think any of this really has anything to do with my problem anyway, but I include it just in case.

The form background is an embedded tiled bitmap image (.bmp) and the buttons are small embedded .jpg images in image boxes over which I've placed transparent command buttons. There is also one other image box containing the company logo.

When the mdb is launched, the switchboard form autoloads and everything initially works well both visually and mechanically. However, when I click a button that contains only the following code
Code:
Private Sub cmdButtonD1View_Click()
    DoCmd.OpenTable Me!Dependency1Table, acViewNormal
End Sub
the table displays properly (maximized "over the top" of the form), but as soon as the table is closed, the form loses its initial appearance. It is now shifted to the right, leaving blank space between it and the left edge of the screen; the right edge of the form, which initially filled the screen all the way to the right edge, is "chopped off," with blank space to the right. Depending on the physical screen size of the user, sometimes the form is chopped right through a command button control, leaving about half of it showing. The horizontal scroll bar is not activated at that point, so you can't scroll to reveal the rest of the button. (I hope this description makes sense.) By "blank space," by the way, I mean without the tiled background, just the background specified in the active Windows theme.

I read some posts on reducing screen flicker, and others said they had trouble when the images were not .bmps, so even though my symptoms were different I had a hunch it might be related to the images somehow. I've tried putting a Me.Repaint in the form's On Focus event, eliminating the acViewNormal in the code above, and enabling/disabling the scroll bars and Record Selector in the form, but those actions have made no difference. I've also toggled the File > Options > Current Database > Picture Property Storage Format, but that didn't help either. Closing the database and reopening always (at least I think always) fixes the problem. It isn't a problem with my specific PC because the same thing happens to other users on their machines.

Can anyone explain what is happening and how I can fix it?
 

khodr

Experts still Learn
Local time
Today, 22:23
Joined
Dec 3, 2012
Messages
112
Try to use the Me.Restore instead of me.repaint and why don't you make form for the required table and use the command button wizard to create a button to open the required form
 

MostlyFrustrated

New member
Local time
Today, 14:23
Joined
Oct 9, 2012
Messages
9
Thanks for your reply, KHODR, I appreciate it.

I assumed you meant to put the Me.Restore in the form's On Got Focus event. I substituted DoCmd.Restore because I got an error on the first statement. Interestingly, this seemed to fix half of the problem ... the form no longer shifts to the right, but stays on the left hand side as it should. The right side still chops off, though.

Your second point (creating forms to display the tables) seems like a reasonable suggestion, but there are about 12 tables, so I was avoiding that because of the effort involved. It also seems like a work-around, and while I realize we must resort to those periodically, I was hoping for a more intellectually satisfying solution. ;)
 

khodr

Experts still Learn
Local time
Today, 22:23
Joined
Dec 3, 2012
Messages
112
You don't have to design any form you can create the form and on the form settings choose to the form view to be a datasheet view and by then your form shows up like a table and not as a form
 

MostlyFrustrated

New member
Local time
Today, 14:23
Joined
Oct 9, 2012
Messages
9
Okay, I tried this method. I made a form to display the table data, then opened the form instead of opening the table. Unfortunately, the result is exactly the same ... when the new form is closed, the form underneath it is chopped off on the right hand side as I described originally.

Any other theories about what is going on?
 

Users who are viewing this thread

Top Bottom