Microsoft Access 2007 Input Form - ms-access

i am new in MS Access database and i have a problem to in insert form. I have already
created a relational database in MS Access 2007. Now i need to create forms to create a insert data.
Let me go with details,
I have two tables,
User - Columns(Id[PK],Name,Address, CountryID[foreign key ])
and
Country - Columns(CountryID[PK],Country Name)
So i need to create a input form for User table that will display the Country Names as Dropdown/select box and the data will be showed from Country table. When anyone selects a country i will save the CountryID of that country.
I have checked in googled but almost all of them stores the same value that is selected but i don't want that. In my case if a Country Name is selected then corresponding CountryID will be saved.
Thanks in advance.
pks

Right-click on your dropdown box. Select the Properties menu.
Scroll down to Row Source Type. On the right side you should see a
drop-down arrow. Click it and select "Table/Query"
Just above that you should see Row Source. All the way to the right
you should see an elipsis ("..."). Click that and select your Country
table.
Just below that you should see "Bound Column". Make sure that's set
to "1". That will bind the first column to the "Value" property.
Now, when you select a country from the dropdown, it will display the name but will have a value of the ID. So, Country.Text will be the name, Country.Value will be the ID.

Go to design view of the form. you use the Control Wizard when you add a combobox to your form, a wizard will guide you through the steps of storing the ID, but showing the Name. Go to the Design tab. Click on the Combobox icon and then click on your form. If a wizard does not start, go back and turn on Use Control Wizards on the dropdown list under the icons. On the first screen, choose I want the combo box to get the values from another table or query. Then you'll specify Table: Country. Add CountryID and CountryName. Sort by CountryName. The next screen will hide the CountryID (because it is a primary key) and just show the CountryName. Specify that you want the value to be stored in the User table's CountryID field. Specify a label and click finish.

Related

How to get combo box selection to fill related fields with data

I have a table [inventory] with inventory items, and a bunch of columns with different information for those. Mainly, part#, description, price. I am trying to create both a purchase order form [POForm] and, and a inventory transactions form [TransactionsForm], but that one thing I've been stuck on is getting a combo box look up I use to select the part# from [inventory], to also fill my fields for description, and price for that item in my form. I need the fields that are filled to be able to have formula's run off of them, and the information to be saved into the table for that form [TransactionsTable], [POTable].
I've tried making my part# combo box include the fields for the description and price, and using =[part#].[column](x) in the other fields as a lookup, and it looks right visually, but that is apparently just a visual of that data, but technically the field is still blank, because those other fields remain empty in the table for that form, and I am not able to run a formula off the price.
As per my understanding and please correct me if I am wrong. you have a form that shows your inventory data Part# Description & price. This form has a combo box that allows you to select a particular part # to view its related record data description and price.
Now you want to click a command button after selecting a particular part # to update your transaction form and POtable.
1.you have to create a query,
2.insert the inventory table in it
3.select append from the query type in the ms access ribbon
4.a window will appear, choose the transaction table as the destination table to append to.
5.double click on the fields that you want to retrieve its data from the inventory table
6.then in the table below in the query itself in the "append to" row you will find drop-down menu including all the fields from the transaction table. choose the corresponding fields. note if the fields have the same name in both tables access will do it automatically.
7.in the criteria row type the following [Forms]![Inventory Form Name]![the name of the field in the form]. do that for each field in the happen query.
8.save the query and name it
9.go-to design view in your inventory form and create a command button, in the click on event creat macro of the following: openquery-->type the append query name
10.save and close macro builder
11.open your form, select part#, click on the button
12.access will ask you to confirm appending process. click ok/yes
13.check your transaction table to confirm that the append process was successfully performed
14.Tip if you do not want the confirmation msg of append to appear, in the click on event go to the macro builder and choose in the ribbon show all actions then in the first line of the macro builder insert setwarnings - NO
the same is to be applied for the POtable.
Anyways, I hope you find this clear and helpful but I have only one concern you do not have to append part description and price in transaction and PO tables as you already have this data in your database in the inventory table. Generally speaking no need to include the same information in multiple tables otherwise you are not benefitting from the idea of a relational database.
I hope I addressed your inquiry.

How to implement multi-select?

First of all, I need to say that I never worked with Access or any other databases before. I'm trying to understand how it works and picked "Students" template for this task (see step 0). Now, let's start.
i. Creating the base from the template and fill it with data
Step 0. Creating new database based on "Students" template:
Step 1. On the objects pane (i.e. left sidebar) search for Student List form and double-click on it:
Fill the First Name and Last Name for the first student: it will be Mike Smith.
In the Special Circumstances column it is possible to select multiple circumstances: for example, Circumstance 1 and Circumstance 2. And if you click on the icon below the combo-box, it is possible to edit the list of available check-boxes:
Step 2. After we have created the entry for the first student, double-click on the Guardian List form and create entries for 3 guardians: Jane Roe, John Doe and Jill Joe.
Step 3. Return to the Student List form. Click on the Open cell in front of Mike Smith. It will be opened Student details form for this student. When it will be opened, click on Guardian Information tab - and you will see, that all 3 guardians are available for combo-box:
ii. Now, my task
I want to see the guardians directly in the Student List form - the same way as Special Circumstances located.
I want to get the option to select multiple guardians for each student - the same way as Special Circumstances check-boxes are implemented.
iii. How it was solved myself, but only the 1st point of the task
To simplify the task, I will use Student ID column (located on the Student List form), instead of creating new column.
On the left sidebar - click on Student List form with right mouse button and then select Design View. When Design View will be opened, select Student ID field, right click on it, then click Change To and Combo Box:
Then, on the right sidebar select Data tab, set curson inside Row Source field and then click small ellipsis (...). In the Show Table window select Guardians and then click Add button and close this small window.
Then, in the large window, do this:
And then click Save As and Close on the ribbon.
Then, switch the Student List form back to the Layout view (the same way, as we switched it early to Design View). And you will see that the first point of my task is solved: the last names of guardians are available in Student ID column:
But how I can implement multiselect, the same way as it is implemented in Special Circumstances column? So, Mike could have both Jane Roe and John Doe as his guardians.
Multi-valued combo boxes are very odd controls. Avoid them whenever possible.
Creating an unbound multi-valued combo box is not possible (see How can I create a Multiple Value Combo box on an Unbound Form). A combo box is multi-valued when the field it is bound to is multi-valued, or when it's set to a multi-valued lookup.
To change a field to a multi-valued field, you need to alter the table design, and set the Allow multiple values property to Yes:
This will automatically change any combo boxes bound to this field to multi-valued combo boxes.
Note that I highly recommend not using this approach. This database already demonstrates a junction table, the recommended way to manage many-to-many relationships. Using junction tables and multi-valued combo boxes is not possible without using very hacky techniques.

Add new Items in a combo box in access

im new to access 2007
I have 3 tables and One Form..i have Accounts,IT and Software tables..i have created each table and enter a values for them(ID,Description).. i have another table called Faculty which i have the AccountsID,AccountsDesc,ITDesc and SoftwareDesc as attributes in my combo box form.So when i did my Query all working fine.even if Accounts Desc start with first character as 'F' it able to pick it up..because Finance was already entered in my database..My Question i want to add a new Accounts Name on the combo box without add from the database?..so that it can be saved in my drop down list if its selected again.. i try many ways but i cant..anyone can solve my problems?..
You can only have your combo list come automatically from a table, or by entering it manually into a value list. You can't do both.
So, to solve your problem, you'll have to use VBA. I'm just going to give you the rough steps here. You'll be ale to search for details if you don't know how to do a step.
In the Form_Load event, you'll build your list.
You'll do this by opening the table or query that has the values you want in your list, reading it one record at a time, and entering the value into your combo box.
The command for adding an item to the combobox is ComboboxName.AddItem value.
Then add your additional value you want. ComboboxName.AddItem "New Account"
Good luck

Linking Controls in Access 2003 Form

I created a form in access that populates a table, TABLE1 which pulls information from different tables for example, the database is supposed to capture trouble calls that come in from different sources, there are fields like: location, division, line, date, employee, employee id, comments, etc.
On my form, the location, division, and line come from TABLE2 (I have the location in the form of a combo box with a drop down listing all the locations); the employee and employee id come from TABLE3 and the user inputs the date and comments. All of this information gets saved into TABLE1 except for the division, line, and employee id because I don't need to save them into TABLE1 as I have created a query to pull all the information together.
When the user chooses "location" I would like the division and line fields to automatically populate on the form but not be available for the user to update (because I don't need it to be inputted into TABLE1) I just want the user to be able to see the it.
Is this possible? Thank you.
Set the Row Source (the query) of your combobox to include Location, Division and Line (in that order).
Then, set the Control Source of your textbox where you want to display the Division to be
=[LocationComboBox].[Column](1)
and the Control Source of the textbox where you want to display the Line to be
=[LocationComboBox].[Column](2)
Change the LocationComboBox to match the name of your combo box.
You will probably also want to set the Enabled property of your Textboxes to False so users don't try to edit the Division and Line.

How can I create a Multiple Value Combo box on an Unbound Form

I need your help on MS Access 2007.
I have a big problem with my MS Access Unbound Form.
How can I create a combo box i do not want bound to a table, show a multiple value List?
The Combo is named Sector and want these values to be selected in Multiples 9Which should be possible in Access 2007) from the Drop Down List: Fertilizer, Seeds, Pesticides, Veterinary products, Animal Feed, General.
Which Select Statement or VBA code can I use. I need a solution to handle this please.
Precisely a ListBox control will help you. Since you are using it in MS Access - it makes it much easier with the wizard where you can type the items list. Or if you want to use VBA, then you can load the list using AddItem property of ListBox control in the Form_Load event.
Here is one way of doing what you want:
Open up the table your Form will use. Then: Datasheet view, Datasheet Tab, Lookup Column. Select option: I will type in ... Next Under Col1 enter one of the user choices you want; for example
A Dogs, then under that enter another choice; for example B Cats, etc Next give your lookup column label a name or stay with the default. Finally, Check Allow Multiple Values box. Finish.
You now have a table with a combo box that allows the user to select 0, 1 or many choices.
But you want it on a Form.
Create Tab, Click Form. You now have a Form that has a multi value combobox.
But you want it on a form you already created.
Right click the ComboBox. Copy. Close the table and open the form you want the ComboBox to be a part of.
Right click on a clean part of the form and Paste.
Hope this is what you were looking for.