I need to be able to type in text box and for the list box to show me all similar text. No VBA )-: (1 Viewer)

Lah_01

New member
Local time
Today, 17:52
Joined
May 19, 2024
Messages
3
Hi all,

I am quite new to Access and the VBA world but managed to create a lovely form using VBA in excel. My work place has disabled macros so when I took the file to work it would not work. I decided I would use Access (better for what we are doing anyway). I have recreated the form however the search option I originally used was a combo box with a command (search button). You start typing in the combo box and when the correct item is chosen in the list you press search and the form populates with specific fields for that record.

The Problem
The problem with this is when there are two similar texts in the combo list. The form populates record 1 as a default. This is very annoying. In the excel form I created using VBA you could type in text box and the list would decrease showing all the possible options that match the text in the listbox. From there you could choose the correct one.

Is there anyway I can recreate this using only the macro builder (No VBA) in Access?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:52
Joined
Feb 19, 2002
Messages
43,612
Access works the same way if you are not using any code to alter the behavior.
 

Lah_01

New member
Local time
Today, 17:52
Joined
May 19, 2024
Messages
3
Access works the same way if you are not using any code to alter the behavior.
Sorry are you saying it will work or it won't work. It was working perfectly in excel but in Access I don't know how to do this without VBA code unless I use the combo box method and that method is glitchy.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 11:52
Joined
Feb 28, 2001
Messages
27,404
Pat's comment was that Access VBA and Excel VBA both are VBA and work the same way. The control objects (such as combo boxes or text boxes) work the same way. The difference between Access VBA and Excel VBA is whatever specific object the VBA code is working on, not VBA itself.

However, your question contains the seeds of its own doom in this limited sense.

My work place has disabled macros so when I took the file to work it would not work.

Is there anyway I can recreate this using only the macro builder (No VBA) in Access?

The Access macro builder will produce something that ALSO would be useless if macros are disabled. Your better bet would be to inquire as to whether your office rules allow you to declare a "trusted location" which would allow you to run macros if the DB file is in that location.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:52
Joined
Oct 29, 2018
Messages
21,583
Hi. Welcome to AWF!

It would be hard to work with Access without VBA enabled, but I suppose some functionalities are possible using only macros. If you need help with your macros, consider posting a sample db.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:52
Joined
Feb 19, 2002
Messages
43,612
@Lah_01 If you have no code that is altering the behavior of a combo or listbox, when you type into the box, the controls fills as you type. It doesn't automatically drop so maybe that is what you are asking how to do. You always just tab to fill with the rest of the current value.
 

Lah_01

New member
Local time
Today, 17:52
Joined
May 19, 2024
Messages
3
@Pat Hartman Yes that's what I want. A textbox that controls the filtering of a list box, but I am not able to use the code builder. Functionality of the form only works when I use the macro builder and I am not quite sure how to achieve what I want to using the macro builder.

@theDBguy I have attached a sample DB with one form of what I am trying to achieve, and another showing what I currently have. (The trying to achieve form has a text box that isn't linked to the list because I do not know how to do it)

You will notice that the 'what I currently have' form is glitchy. When you click the search button it defaults to record 2 and then starts to work when you go down the list and choose an option (sometimes!). I think this may be sure to the fact that I set the data entry field in form properties to yes. I had to do this so when you open the form you get blank boxes.

This form is not for data entry it is just to view a record based on what the user chooses or types in the text box.

I need for it to do the following:-
1) Be blank when its opened.
2) User is able to type in the search text box, which filters a list , then you can choose correct item.
3) Form only populates when an option from a list has been chosen and the search button is clicked

This I managed to do with VBA in excel . With Access however I can't used VBA.

I hope this makes sense.
 

Attachments

  • Sample DB.accdb
    896 KB · Views: 20

Gasman

Enthusiastic Amateur
Local time
Today, 17:52
Joined
Sep 21, 2011
Messages
14,537
This I managed to do with VBA in excel . With Access however I can't used VBA.

I hope this makes sense.
Not to me? Why are you able to use VBA in Excel but not Access?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 12:52
Joined
Feb 19, 2002
Messages
43,612
I don't create macros.

This is the single line of VBA that does what you want.
Code:
Private Sub combo_Search_GotFocus()
    Me.combo_Search.Dropdown
End Sub
It goes in the GotFocus event. There may or may not be a way to do this with a macro.
 

Users who are viewing this thread

Top Bottom