Create product form that allows selection of any item with MS Access - ms-access

The following is a simplified version of my problem:
We have a product table containing all items available in a store. The customer should always see all products available for purchase. The items the user selects should be associated with his invoice record. I have modeled the relationship as follows:
tbl_Product <-1---m-> tbl_ProductInvoice <-m----1-> tbl_Invoice
How can I create a form that opens up to all products being available for selection. The solution "must" allow the customer to use a checkbox per product to make the selection. Listboxes are not allowed.
My solution to this problem is to have a bound invoice form with an bound product subform. When a new invoice is created, all possible product combinations are created, with the checkbox being set to false, so that the subform shows the products. What would be a more efficient way of doing this?

Related

Bound textbox in main form to lookup query in subform

I'm working on a project that involves generating a rental and later being able to return to manage the rental in the future (i.e. return the rental, the bill for damages, etc.
I have a query that creates rentals with an auto number for the id.
Another query creates a list of items for each rental - this query is associated with 2 subforms (one to initially list items in a rental, and one to later return to declare items returned/damaged, etc..)
To manage the rental, I have a form where I want to be able to scan a bar-code equivalent of a rental ID and pass the value to a subform to display the details query (table view) to be able to edit/process rental items. When the textbox is bound, it throws an error stating that I cant type in the field because it is autogenerated. If I leave the textbox unbound, how would I pass the value to the subform to be able to process the rental?
Any input is greatly appreciated!
I suggest you create a new unbound text box and a Search button next to it. The button will have code to filter your subform according value in this unbound text box where user types the ID.

Access 2010 - display related record in a form

I have 2 related tables.
Invoice (fields: number, buyer, supplier, etc.)
Company - all buyers and suppliers (fields: name,etc.)
Buyer ans supplier fields on invoice are referencing same field (company_id from company table)
On invoice form, I choose supplier ID from dropdown list and also buyer ID from dropdown list.
Task: To make the form little bit readable, I would like to automatically display a name of company after selecting company id in both fields.
What I did:
I manually dragged the company name field to the form and wizard asked me which field I would like it to connect to (byuer or supplier), so I got 1 field working. How to create another field that shows company name? If I drag another instance of company name, wizard does not show so I can set it up and I can not find anywhere setting for that. Thank you for help.
I think the best way is the following:
Create a lookup query: Create a new query similar to this “SELECT CompanyId, CompanyName FROM t_Companies ORDER BY CompanyName;” and save it as “ql_Companies”
Edit your Invoice table. For both your fields Buyer and Supplier do the following: Click on the field and select Lookup in the filed properties. Set the following properties: Change Display Control = Combo Box, Row Source = ql_Companies, Column Count = 2, Column Width = 0;5 and save the table.
Now when you create a new form based on your Invoice table the field will be automatically shown as a combobox.
You can also do all this manually on an existing form but then the combo box will only show on this one form. If you prepare the underlying table with lookup queries then this will work in all queries and forms automatically without additional work.

Query a table by value in main form and load subform - Access 2007

When I open Order Form, it should show the list of products already present in that order in a 'ProductsCartForm'
My tables are as below:
OrderTable:
OrderId - Autonumber
CustName
ShipAddress
Amount
ProductCartTable
ID - unique
OrderId - one orderId may hold many productIds
ProductId
Quantity
UnitCost
I want to create 'ProductCartForm' in my main form 'OrderForm'. I have a parametrised query 'qryProductsByOrderId'. If I create a subform based on qryProductsByOrderId, how can I pass the parameter 'orderId' to the subForm before/on Loading.
Some one pls help.
Thanks.
Like Roland says, no VBA necessary. This is what Access does well :)
Make your form for your Orders (necessary to have record source of OrderTable). Then make your form for your Products (doesn't need to be perfect, just needs to exist and have a record source of ProductCartTable). Save both. Close the Products form.
Go into your Orders form and drag your Products form on it. This will create the products form as a subform. It will likely populate the Master/Child links for you but if it does not you just need to write in OrderID for both because it is what joins the two record sets together.
This effectively does a left join for you. Only product records which are relevant to the order being shown will show on the subform.

I haven't found an answer to suit my needs yet. How do I populate multiple tables using a single form?

I have a main table that is populated by a single form. This table has all of my customer info and lists all of the products we sell with the amount sold of each product to each customer. I am creating seperate tables for each individual product. I would like to know how to make this single form populate a row in the table for each individual product if the amount sold to a single customer is at least 1.
For example, say I'm selling widget_1, widget_2, and widget_3. On my main table, the customer info will be populated no matter what. Now, I have one table for widget_1,one table for widget_2, and one table for widget_3. If a customer orders only a #1 and a #3, I want their info to be input into the tables for widget_1 and widget_3, but not widget_2.
How would I do this?
Is there any reason why you cannot have a subform for widgets 1 to 3, if only a limited number of widgets are available? The main form does not have to be bound, the link master fields can be set to controls matched to the relevant subform fields, so that the data is automatically populated to the widget table when a quantity is entered into the relevant subform.

Access form, search for a record from another table and insert into field in current form

I have a table that stores invoices and a form based off of that table that looks like an invoice so that you can search previous invoices. Currently I am creating the invoices in excel and then exporting the data as a new record into the Invoice table. I was wondering if there was a way I could create the invoices from my Invoice form. I have a table of all of the products and prices we carry that would used for the invoice.
Is there a way to put a search button on the invoice form that would search for a record or "product" in the product table and insert it into the fields of a new invoice?
I have looked a some code to connect to the products table and insert it into fields in the invoice form, but how do I search as well?
Any thought or ideas? Any help would be much appreciated!!
Handling this through VBA and control events is typically the best choice:
Use an unbound text box in your form as your search input field. This will allow the user to input some text into a box and hit enter, or click some related "GO" button if you choose to perform some sort of search.
Set the `OnChange` property of this text box control to the name of the macro or method you designed to handle this event (or click event property if you've instead set up a button to a) check the textbox value; and b) handle it; typically allowing for both the user pressing enter or clicking the button to perform this action). You may also simply call an `inputbox` from some button click event to pop up a prompt to allow the user to enter the product value to search for.
Within your handling script, use DLookup() to use that user-supplied value against your products table to get some meaningful product value back which you can then place anywhere on your form.
Also, although I'm not familiar with your particular setup, it seems as though you should ditch your excel file and go with a direct user interfacing MS Access input form. You may find it always easier to deal with user input directly rather than indirectly through oustide files. That way, you have better control over user input validation and user feedback vs fearing whatever the Excel client feels like putting in those spreadsheets.
Not sure this is the right design. Do you only invoice one product at a time?
Also, it doesn't sound as if you are thinking in terms of primary keys.
Nor does it sound as if you thinking "relationally".
Let me clarify. In most invoicing systems, there is usually an Invoices table, then an InvoiceItems table. The relationship between the invoice items and the invoice would be one invoice to (potentially but not necessarily) many items.
Then you have your Products table. The relationship between the Products and InvoiceItems is one product to many InvoiceItems. Ie, you can sell a given product to many different customers.
So we have:
Invoices --> InvoiceItems
Products --> InvoiceItems
Now you need to implement this in your forms.
Matching your tables and their relationships, you create an InvoiceForm and you create an InvoiceItemsSubForm. The InvoiceItemsSubForm, to hold many items, is a continuous form.
In the InvoiceItemsSubForm, you will have a field that takes the Primary Key of the Product (along with other fields such as date, number of products purchased, etc).
To search for your products, you can have a combo box that has the ProductId and ProductName fields. This combo box serves two purposes: it allows you to search for your products, and it allows you to input the product you want in your InvoiceItem record.
If I have misunderstood your question, my apologies. If I haven't misunderstood your question, you have a lot to learn...