Autocomplete/suggestion in MS Access - ms-access

I have a database in Access, and I want to create a Textbox like this:
The suggestions come from the Database itself. It's for search for an item which are already in the Database.
How can I do that?

Create a combo box and in the property sheet, go under the data tab and set "Row Source Type" to Table/Query.
Set the "Row Source" to: SELECT [field] FROM [Table];
You should be able to search and it will autocomplete but you will need to click the dropdown arrow too see the suggestions.

Related

Drop down list in access form and displaying the data from the next column

Please help me with the following topic.
I'm having a hard time inserting a form in which i need to select from a drop down list the name of the project and below to display the data from the ProdFinit column.
I've tried using combo but i'm new to Access and i thing i'm missing something.
Thank you for your help!
You're on the right path using a combobox. Look at the format tab on the design properties for your combobox. Here I have a form where the user inputs the zip code, but I also want the user to identify the city and state at the same time. My column count is 3 and I chose how wide to make those columns on the next line down. Beware what column to bind it to on the datatab of the properties box. I find binding it to column 1 is easiest.
ComboBox Properties
Zipcode Combobox

MS access form combo box row source based on current field value

Newb in Access (version I used: 2010) and VB. :(
I have a form and a table both named "issues", a combo box named "statusfield" (value list: open, reopen, wip, closed).
The form loads the content of table "issues" per record. One can modify the field value of records.
The aim is to show the available value list based on the current status of an issue.
For example, if the current value of "statusfield" is empty, when one clicks the combo box, available status would be "open;reopen;wip", and if the current value of "statusfield" is "open", then available status would be "wip;closed".
Could one explain as detailed as possible please? Appreciate it!
Add this code in the AfterUpdate event of the combobox
If Me.statusfield.value = "open" Then
Me.statusfield.RowSource = "wip ; closed"
End If
So I redesigned the database, created the one to many mapping in (Database tools -> Relationship), with the same vba, everything works as designed. Cheers!

Am I looking for an "After Update" event or something else?

I'm trying to make a database for paperwork for a summer camp. Right now I have a form setup that has a combo box with the the children's name in the header. And I have three tabs separating the different papers they need to turn in (medical, permissions, etc). I have the combo box working, sort of. When I click on it I have it showing the list of names, but I don't seem to have it connected to the underlying table, so it could show the records. The records are all a mix of checkboxes (yes/no) and text boxes (for additional comments). Does the combo box need to have an After Update event, or would it be in another event? I've tried copying some code that I've found, but it hasn't seemed to work. Right now there should be some information that shows up that I've already entered directly into the table, but other fields I know are blank.
My goal is to be able to select a child from the combo box and pull up their records and edit information as needed. I'm a real beginner with coding, but I think it's something that would lead me to a solution here. I've been across a variety of forms today and nothing seems to have worked for me yet. I'm also just beginning to learn access so I'm only starting to know the kinds of questions to ask. Any help or suggestions would really be appreciated.
In an Access form, there are either bound or unbound controls. Bound means table fields are connected and unbound means there are no table field connection. The same can be said about bound and unbound forms where bound has a whole table connected to form and unbound does not. If you enter Design View, you will either see a field name in textbox or "Unbound" written in textbox. For checkboxes you cannot tell unless you enter its Property Sheet \ Data tab \ Control Source.
From your explanation, you seem to refer to a search box. This would be an unbound form as no data should be tied to it. Your header of Student's Name seems to be a bound textbox of student name. Search boxes have an AfterUpdate event built in either as a macro or VBA that searches a record that matches the selection of the drop down:
Macro:
Search Record
Object Type: Form
Object Name: YourFormName
Record: First
Where Condition: ="[ID] = " & Str(Nz([Screen].[ActiveControl],0))
VBA:
DoCmd.SearchForRecord acDataForm, "yourFormName", acFirst, "[ID] = " & Forms!YourFormNam!DropDownField
Please note you can create a search box simply by placing a new combo box on the form and following the Wizard all the way through. The outcome of this will be an AfterUpdate event macro as listed above. You must have canceled the wizard before finishing to have an unbound combo box with no functionality.

Access 2013 Cannot Set Lookup Display Control to Text Box

I have added a new field to an existing database and set the Data Type to Yes/No as shown in Pic1.
This defaults to Check Box. If I then try and select Text Box (as shown Pic2) it immediately reverts to Check Box. Combo Box can be selected successfully.
Can someone advise why I cannot select Text Box? There are already other fields configured in this manner in my database. Also of note if I change these other fields to Check Box and try to change them back to Text Box, they also revert to Check Box.
I am facing the same problem. For some reason you cannot choose text box as lookup option.
There are two workarounds:
Choose combo box and
Row Source Type: Value List
Row Source: -1;Text for yes;0;Text for no
Column Count: 2
Column Widths: 0
Source, from MS answers forum
Or select datasheet view, click fields under table tools, select more fields and go to Yes/No then select Yes/No. Now you can choose text box as look up option.
I was able to confirm the change in behaviour between Access 2010 and Access 2013. Access 2010 allows us to choose "Text Box" for a Yes/No field. In Access 2013 the "Text Box" option is still there in the drop-down list, but when selected it immediately switches to "Check Box".
I'm afraid that's just the way Access 2013 works. If you really need to make the change you could try to locate a machine with Access 2010 and use it.
Try using :
CurrentDb().TableDefs("YourTable").Fields("YourField").Properties("DisplayControl")=109

How to use a query as a source for a report in MS Access 2007?

I did the following in MS Access: I made a form which had a combo box and a button. You select an option from there and click on the button and it is supposed to open a report. Now, I wrote a query selecting a few fields from a table and in the where clause, gave the condition as where name=str(combo1.value) and the report source was specified as this query. Now, when I select the value and click on the button, it opens a blank report. How can I make it load only those particular values?
I am not saving the combo box value anywhere. It said that it would remember the value for later use. Am I doing the right thing by not saving it? What should I do to make this work? Please help me!
Edit: The combo box is using values from a column 1 in a table X. I've not bound the value to any field and am using the "Remember the value for later use" option provided. The combo box is essentially a list of hotels and the report is a list of people staying at the selected hotel. When I put the ID of the field (as defined in the X), it works. But the thing is, it should refer to the names of the hotels and not the ID, which I am supposed to enter in a popup that asks for it. What do I do?
Edit 2: The query is as follows:
SELECT Table_1.Hotel_Name, Table_2.Name_of_Delegate, Table_2.Address, Table_2.City, Table_2.Center, Table_2.Spouse_Present, Table_2.No_of_Children, Table_2.No_of_Guests, Table_2.No_of_Rooms
FROM Table_1 INNER JOIN Table_2 ON Table_1.ID=Table_2.Hotel_of_Residence
WHERE Table_1.Hotel_Name=FormName.Combo7.Text;
When I click on the button (which opens the report), it asks for the name of the hotel in a popup box. How can I avoid this? What I am doing wrong?
You can use a WhereCondition with the DoCmd.OpenReport Method as a "dynamic WHERE clause" for your report's record source. Use something like this in the click event of the command button which opens your report.
DoCmd.OpenReport "YourReport", , , "[name]=" & Me.combo1
Remove the WHERE clause you added, where name=str(combo1.value), from the report's query.
I surrounded name with square brackets because name is a reserved word. See Problem names and reserved words in Access
Edit: In a comment, you said this about the combo box:
"Row Source is SELECT [Table_Name].[ID], [Table_Name].[Name] FROM [Table_Name];. Bound Column is 1 (which I assume shows the names I wish to be displayed in the combobox.)"
When you refer to the value of a combo box, that value is the value of the "Bound Column". So in your case, the bound column is 1, which means the combo value will be [Table_Name].[ID]. However, you want to open your report based on the [Name] column of the combo. So change the bound column of the combo from 1 to 2.
To open a report using the value of your combobox, in your report query you need to do the following:
SELECT fields
FROM table
WHERE YourValue = [Form]![FormName]![ComboBox Value]
You have to specify the name of the Form, plus the value so the report query knows the value. Hope this helps.