Access Database Controlbox not displaying - vba

I'm having some trouble with a database in Access. One of the forms is too big for the monitor and spills over off the edge of the screen. Now, this wouldn't be an issue if I could just set the form to full screen using the Minimize/maximise buttons.
However, no matter what I try (Changing from Tabbed/Overlay, ensuring the Controlbox is on, Min Max buttons on, Modal on) the Min Max buttons still do not appear. They do appear after going in and out of design mode, but that's not something I can ask the end user to do. I'm wondering if some VBA code would help but I can't find anything that will work, is there anything you fine people suggest?
Thanks in advance!

Related

Cannot edit cells after touching combobox - I think i've encountered a bug

So here i was building a form in excel for work ya, and to make it easy on the eyes and fool proof i removed 90% of the UI. On that form i put some activex combo boxes. Everything was perfect, and then i tried to edit a cell after i entered in the data in that combo box, but low to my woes i couldnt.
It seemed that touching the combo box locked every other cell in the form. Flabbergasted i did some experimenting and found a way to isolate the issue. Thus i created a test environment for the error(doc linked below). When the UI is removed clicking the combobox locks all other cells. But when the UI is there, no issue happens. Furthermore it seems the formula bar being disabled is the cause.
Is this a bug, a programming error, or something else. I'm at a total lost and would appreciate any help.
My test File, for those how want to try it
When in edit mode shift+esc to hide UI, when hidden hold shift+ctrl then type edit to bring back UI.

VBA Access: Can't seem to associate new menu items in pre-existing option button menu on form

Recently we had to do a massive overhaul to a report that was written by my predecessor, the strangest problem I seem to be having is that it has an options menu, which as the report runs, it filters down through.
Now, we've had to add some new options to the report, only the new option buttons won't associate themselves properly with the menu and I'm at a loss as to why this might be. Unfortunately the report does not run correctly without these option buttons being properly associated.
When I'm in design mode, the option buttons show the sunken actively clicked image, but when they're in form mode, they're grayed out as if they're not a selection. I'm pretty sure I set them up correctly, but I'm going to go with "I did not set them up correctly" and can't seem to figure out why they won't associate properly.
https://www.dropbox.com/s/6rewpbkmyx7d336/option%20button%20issue.png?dl=0
Sorry for wasting peoples time, I figured out the issue, the new options weren't housing themselves in the Option Group.

Very slow design view on a complex form with a lot of controls

Let's start with a confession: I came from a VB6 background, and I'm accustomed to coding within the events of objects on a form, and as such my code for events ends up in somewhat random order in the code window. With this habit, it's never been very important to remember the names of controls (although I name them well)... I just double click on a button in the design view, which brings me straight to the code for that control's primary event. If I forget the name of a control, I click it and view properties. It's not a habit I've moved away from.
Well, now this is catching up to me. Using VS Express 2013, I have a form that contains a HUGE number of containers-within-containers, labels, buttons, and other doohickeys. I ported my code from VS.NET Express 2008 where this wasn't a problem. But now the act of selecting any control in the design view takes around 10 seconds before I can view its properties. If I drag to resize a control, and another 10 seconds passes before I can select another control. It makes designing this form nearly impractical.
In this particular project, I'm using use a tab control (which is never visible to the user) to design many "screens" which each contain panels full of controls. The panels for each "screen" are moved out of the tabs and docked into the main form as requested by the user changing screens. (I'm using the term "screen" to mean a window full of controls, usually maximized.)
Within the same project, a simple modal password-change form isn't slow to edit controls visually, even if the complex form is still visible in the IDE.
My question is in three parts:
First, what the heck is it spending all that time doing?
Second, is there a setting I can tweak to improve the speed?
Third, should I give up on trying to speed it up as-is, and move each "screen" into its own form for design purposes to avoid this slowness? (It's a lot of work to do that now... see next paragraph.)
Thus far I have avoided separating "screens" onto separate forms because I don't want a new window to come up when users change screens, and because code for the controls in one screen may affect the properties of controls on other screens... In such cases I prefer not to write out
form.doohickey.text = "blah"
..but rather keep it as ...
doohickey.text = "blah"
I'm using VB but I don't think this question is VB-specific.)
First off, I feel your pain. I have a management section of the application that I'm writing and I'm using a TabControl as well. I have 10 tabs so far and I've only added controls to about 4-5 tabs. I just added up the controls I have and there are about 360 controls so far on this one form and the designer file is ~3300 lines long. Currently anytime I change a property value of one of the controls or go to save the Designer, it takes about 3-4 seconds each time. I have a fairly decent machine; i5-3320M, 8GB RAM, intel 330 SSD, and it still takes a bit for it to do things within the tabControl. It also takes FOREVER to open and load the designer on that form...
What I've found is that it is easier to open a new instance of Visual Studio, create a test application, add a TabControl with the same properties, and design a new tab page from there. When I'm done I do a copy-paste into my actual project. This works great except for the few custom controls I've written in my main application project, I just have to sit and wait while adding them.
I'm now answering my own question. This is the approach I've ended up using, and it helps a lot...
My overall goal was to have an interface that didn't present a lot of windows, but still presented many different "screens".
I used to place all the different controls of different "screens" on separate panels, which were each contained in separate tabs of an invisible TabControl. I would then move those panels to my main form as needed by changing their Parent property of each panel as needed. The only problem with this is that the Winforms designer got ridiculously slow as the number of controls on a form increased into the hundreds.
Now, I am now designing each "screen" as a separate form, each of which contains a panel whose Dock property = Fill. Such a panel contains everything else on the form. The form itself never becomes visible.
As needed for to view various screens, I execute:
ScreenForm.Panel1.Parent = Mainform
...or, depending on how I lay it out...
ScreenForm.Panel1.Parent = Mainform.PanelXYZ
...I also either unload or hide any panels which already exist in the panel's new container.
I was GLADLY SURPRISED to find that the code for the various events of the controls contained in the panels would still run, because such code exists in the first form's file, not the displayed form's file. Luckily, it seems I was wrong. Event code follows the control itself. I can copy/paste not only controls, but also their corresponding event code to new forms for easier development and a faster Winforms designer.
All of this is similar to a MDI interface with maximized windows, but no title bar or [X] is displayed.
Essentially I'm doing everything as I did before, except using separate forms with panels instead of separate tabs with panels. The WinForms designer is much quicker because there aren't so many controls on any form.
I think I accidently found a workaround for saving a lot of time when changing the name of a control on a overpopulated container/project. Before you change the name, toggle False/True the "Generate Member" property of the control you want to rename(I believe you can also locate this under the "Name" property). This adds a few more clicks to the procedure but saves a lot of time. My not-yet-finished project has over 4000 controls and multiple forms and some of them are very "heavy" (10 - 20 seconds to normally change the name of a control). This, of course, don't help in anyway with the loading time of the project (about 35 seconds for me) but I can live with it. Let me know if this works for you too.

Can't View VBA Form

So I created a form, and have been using it for a while.
All of a sudden today it stopped working. Other forms load and can be viewed but not this one.
The weirdest part is that the controls still respond!
So I can't actually see the form but I can still interact with it. (only using keyboard no mouse clicks are responding) I know the form is enabled. But I simply can't see it! I have restarted excel, and the whole computer.
I even completely removed all code in the userform to see if I could get the blank shell to load, and while I can tell it loads (it disables everything in excel until I use Alt+F4) it still won't be visible. I have checked the Enabled, All Colors, Captiuon, Width, Height, Top, Left, StartUpPostion, SpecialEffect, Zoom, DrawBuffer properties and everything is fine.
I have also Exported and reimported it and still simply nothing. Also tried importing it into another Workbook, nothing. I at my wits end (not that it's very far to reach!)
Also, I can still see the userform in the designer I can still edit it, I get NO errors. This happens not only when calling the form in code, but even when running it right from the designer.
Any one ever have this issue? Any ideas or solutions?
The issue ended up being the Top and left properties. While I did check them, they way I checked them was not accurate; I still have no idea why, but I think it defiantly has something to do with dual monitor setup.
The way I tested double checked the forms top and left properties was by creating a new form and adding a button on the button click event I had a msgbox show the top and left properties of the form at time of clicking.
I then moved the new form to where I wanted the form that woudn't show to be and clicked the button; I then set these values to the form that wouldn't show.
I tested this location and made sure to match the properties with the values I wanted multiple times and it didn't work.
For some reason the values needed where about 1000 digits off (instead of 250 I needed to use 1250) even though I had set the form right where I wanted the new one to be and made sure to save the properties when they matched what I wanted

How to Control where a form loads

This is going to be the first of many questions I am sure.
I am starting to create an application in VB.net and I am not super familiar with the language yet. I am trying to design an application based off of a system tray icon and by that I mean, when you launch the application, there should be no initial form that loads, just the icon in the system tray.
From there I need to do two things. I would like "on mouse-over" to pop-up the form right above the system tray and "on double-click" have it open in the middle of the computer screen.
I am successful in using "static" placement {Me.Location = New Point(800, 390)}
I can get the windows/forms to open where I want them to, but the problem is when I change to a different computer they don't open in the correct location. I need a way to make sure the forms open in correct location no matter the screen resolution.
Can anyone recommend what I should Google to learn more about form placement or maybe even a link. Being so new to the language, my Google attempts have failed and I am needing more direction and a little hand holding until I get the terminology down and an idea of what I am looking for,...
If you want to dynamically place your form based off the desktop size, check out:
SystemInformation.VirtualScreen.Width
SystemInformation.VirtualScreen.Height
...and move your form based on these dynamic values. e.g.
Me.Location = New Point(SystemInformation.VirtualScreen.Width - Me.Width, SystemInformation.VirtualScreen.Height - Me.Height)
For more information about VirtualScreen, check out MSDN:
http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation.virtualscreen.aspx
VirtualScreen will give you the combined size and width of multiple monitors, so as an alternate, you could also simply look at the primary screen, e.g.
Screen.PrimaryScreen.WorkingArea.Width
Screen.PrimaryScreen.WorkingArea.Height
you can use Me.CenterToScreenTo center it to the users screen and as far as i know that is the best you can do
In form properties there is a property StartUpPosition set it to CenterScreen