Can a combo box be ready for typed input as soon as the form it is in opens? - combobox

The main form of a Microsoft Access application has a combo box as the first field with focus in it's first and main form. I would like for users to be able to start typing into the combo box without having to click on it first. Is this possible? What VBA code would accomplish this?
I already have cboCaseName.SetFocus at the end of the Form_Load() sub. That doesn't do it.

Related

Dhtmlx control form

I need help regarding dhtmlX form and combo list controls. I am getting a problem with the dhtmlx combo that created using dhtmlx control. The list of options appears and disappears immediately when clicked on the combo list. The same problem getting with an input box when I click on the input box the mouse focus is removed outside the input box
Unfortuanetly the porblem cannot be reconstructed in the default samples:
https://snippet.dhtmlx.com/wla7u1xq
Please, check if your events are not blocking or closing the combo operating with the input focus.
If the problem still occurs for you please, provide a sample or a code snippet, to check the deatils of your problem.

Macro won't select value in ComboBox

I'm working on an asset management database for my company. Part of its function will be to track where loaner computers go. So I have built a 2 level navigation form (NavigationFRM).
What I would like to happen is when you select a tab on the the top of the form, it automatically fills in information on the sub form of the form. To do this:
I have created an embedded macro that will select a value on a hidden combo box;
After update event on the combo box will fill out information on the form.
The problem is the macro works and sets the value of the combo box, but that's it. It doesn't trigger a change of info in the other fields.
I'm told that I have to a re-query on the combo box, but I can't access it as it's on a sub form. If I could get the macro to access that combo box and re-query the data, then I could move on.
Main form = NavigationFRM
sub navigation form = LoanerFRM1
Combo box = LoanerSelectCMBO
Please let me know of any other info you may need to assist.

Where is the Visual Basic 6 Combo Box Click Event?

I'm new to Visual Basic, I have scoured the net to look for the event handler for the combo box click event but I cannot locate it. I am trying to make an event happens if a certain index is selected with the combo box1 then another combo box2 will populate the selected the index.
i have looked at links like these but it does not explain how or what the person did to access the _ click event VB6 Combo box events
In the code window for the form, select the desired control from the left drop down, then the event you want from the list of all events in the right drop down:
It will create the procedure for you and make it the active one. This is the same as VB.NET assuming you have the selectors on.
I haven't been using VB6 for ages, but i think what you need is covered here: http://www.vb6.us/tutorials/visual-basic-combo-box-tutorial
I cannot recall having to do anything special when using click events in VB6 at all.
In the first combobox click event, you should be able to have an if statement checking if a certain item is selected using .ListIndex and if so, populate the other.

Opening Button to open form based on combo box selection

I currently have a MS Access database of members.
I have a form that has a combo box which is populated with just the first and last names of members. (using a test database for now)
What im struggling with is how do i create a button that opens another form i have created but using the selection in the dropdown box to populate the fields in the newly opened form.
When a user from the dropdown box is selected an open is clicked i want it to open the profile form populated with their details.
pictures and access files can be found on my ftp server:
ftp://ftp.legends-gym.co.uk
User: ftpuser#legends-gym.co.uk
Pass: ftpuser
Regards
I can't access ftp site from work so can't see what you've got thus far however, the key bits you want to look at here are:
Add a button to the form and the On Click Event to open your profile form. Something along the lines of docmd.openform "frmProfile", acNormal
You need something to pass the member you've selected in the combo box to the profile form. One way might be to use OpenArgs so have a look at that
You then could use the passed variable in OpenArgs to select the data you want to fill out your profile form.
EDIT...
OK, I've had a look at the file now. Here is what you need to do to fix your problems (and a couple of extra bits which aren't causing an issue but will improve the look and feel).
On the Format of the Home form and the Member Search form, set Navigation Buttons and Record Selector to false. - This removes the unnecessary elements for a "single" form, you're not looking at records.
On the member search form, remove the binding to the members table. - You don't need to bind this form, as the recordsource of the combo is pulling the data required separately. if you look at your form before you change it, you'll notice you've got 1 of 10 records...
Also, remove the filter criteria and set filter on load to No - You were filtering the wrong form.
On the combo box, remove the after update event. - I'm not sure what that was trying to do but its completely unnecessary.
On the command button, add an onclick event which has the following code DoCmd.OpenForm "Profile", acNormal, , "ID = " & Me.Combo361 & ""
Save everything and enjoy. :)
You weren't far wrong with the filter, but it's actually a WHERE clause when opening another form - sorry, my bad misdirection. What you were doing was filtering the original form - ie the member search form. Also, you don't need to put ' quotes around the ID, it's a number not a string.
If you have problems I can probably host this fixed version somewhere for you to download.

MS ACCESS 2007 restrict editing to form fields until combobox selection is made

How do i restrict the editing of form fields until a combobox selection is made? I am using MS Access 2007.
Thanks for your help.
On the form, you can start off with all the fields being locked (cannot edit) and disabled (cannot click on them) (you can find those in the property sheet of the form). Then on the On Change event of the combo box, in VBA, cycle through all the fields and enable them again.
This answer provides code for how to loop through controls on a form. In this example, you would set ctl.Enabled = True and ctl.Locked = False (where ctl is the control you are referencing)
A note, to make sure that the combo box is always changed, I usually put "Choose One..." as the first item of the list. And check it on form submission to make sure it's not still selected. That way, it forces the On Change event to fire where it wouldn't if someone used the first option of the list.
Hope that was at least enough to get you started...
EDIT: Additional info
In the table design, I put default value of "Choose 1" on the Combo Box and made it the first option. So when the form comes up, that's what you see.
You can set the Locked property of your memo and date fields to Yes (found in the property sheet under data or you can use the .Locked = True in VBA.
Then, in the on change event of the combo box, click the ... and use the code builder and put something like this:
Dim ctl As Control
If Me.Combo77.Value <> "Choose 1" Then
'Loop through all controls on form
For Each ctl In Me.Controls
'Only text boxes, not labels, or combo box ect.
If ctl.ControlType = acTextBox Then
'Unlock the field and allow editing
ctl.Locked = False
End If
Next
End If
I tried it out and it works on my little test database.
Here is the MSDN article on the control types: MSDN Control Types
To do it this way, I would recommend what I said above and put the first item of the Combo Box something they're not going to choose.

Resources