MS Access 2007 pull data record from a different table to auto populate fields - sql

I am making a subreport in MS Access 2007 for a detail table.
I would like to create a combo-box on this subreport that pulls t_item.item_id & t_item.description from the t_item table. I then want it to pull the data from the chosen record into the MS Access subreport in order to populate read-only fields. These read-only fields will then be used to populate their corresponding fields on t_detail. Note that t_item is not the master table to this detail table.
Users will then be able to fill in the missing data that only exists on t_detail and create the new record.
I have successfully created the combo-box and successfully populated it with t_item.item_id and t_item.description, but I have been unable to force any additional fields to pull in data from the same record. See below.
Ideally, all of the information that already exists on t_item for this record should automatically populated the fields in this snippet. The only ones left blank for the users to enter will be Net Weight and Package Countsince there is no way to know those values ahead of time.
Here is the query that is pulling up that combo box:
SELECT t_item.[Item ID], t_item.[Description] FROM t_item;
I've attempted to change the control source for the remaining fields, but nothing I have tried so far has successfully caused them to auto populate.
A short list of my attempts:
=[t_item].[Item ID]
=[t_item].[HACCP] -- or whatever is appropriate
My research has led me to an Access DB Macro that uses the SearchForRecord action and this where condition
="[Customer ID] = " & Str(Nz([Screen].[ActiveControl],0))
However, I have no idea exactly what this does or how to modify it to suit my purposes. Any guidance would be much appreciated.

Related

Data entry forms into multiple tables in MS Access

I have a data entry form bound to a query which has two tables with a left-to-right join (option 2 on join options).
The fields on the form are all bound to one of the fields from either table in the query.
My problem is that after I enter the data into the form and save it, the data from the right hand table will not show up on the query that the form is linked to, even though the data has been saved into the right hand table. The fields come up as blanks in the middle of fields that are filled. The fields from the left hand table are saved and appear, filled.
I need to be able to do this so that I can display the new data as a sub form in a different form.
Any help appreciated.

MS Access- Generate fields in a form based on combobox choice

I'm using a linked view in Access from the SQL server.
That view contains an employee_name column and many other columns (like equipment , parking, room, date etc). There is a row for each new entry (for example an employee got a new phone at a date and then at another date he got another phone), therefore there are multiple rows for the same employee name.
What I need to achieve is having all the entries in a form from an employee.
What I have tried so far is creating a form based on that view and adding a combobox with the option "find a record on my form based on the value I selected in my combo box active". The problem was that I was seeing users multiple times due to the new enteries mentioned above. I fixed this by doing a select distinct on the employee name in the row source tab.
But now I'm getting only the first entry for an user, what I want is to get all the enteries (maybe in auto-generated textboxes, or anything which will be easy to export to excel, since that would be my next step - to have a button which can generate a report based on the user with all the corresponding entries) like I would have written SQL code like below:
select * from schemaName.viewName
where employee_name = '/*here use the selected name in the combobox'
Thank you for your help, I am a complete beginner to forms in Access and all of these great things one can achieve.

Microsoft Access 2010 - Prevent selection of any combobox option more than once

I have a continuous form that has comboboxes down one of the columns. I would like to prevent the same item being selected more than once per order.
The database is basically a microsoft web database template that im trying to modify to suit our requirements (Desktop product inventory database).
My requirement is,if for example a user selects the 350CC shaver shown below, i want the shaver to disappear from the list of available options from then on.
The form is shown below, with the comboboxes down the product column:
The rowsource for the product column is as follows:
The record source for the form itself is as follows:
So, having a very basic knowledge of SQL, i would appreciate some help in crafting the sql statement required to achieve this.
cheers
EDIT - 9-Dec -14
Picture showing orderdetails cleared off the form and error message.
You need to create a unique index using the primary key of the order details table and the product ID foreign key
Then when a duplicate product is selected the system will not allow it to be saved into the table and will throw an error
However this is not available with Microsoft Access 2010 because the backend data is stored in a SharePoint list not directly into SQL Server table unlike Access 2013.
Instead as a workaround you can create a data macro that will essentially do the same thing.
Example of the data macro can be seen in the following screenshot indicated by the red arrow:
http://screencast.com/t/WjU5qws4Ug

MS Access 2010 Form with check box per record

I'm trying to create a form that allows my audit team to help identify transactions that need further investigation.
Is the following is possible? If so what would be the best method for accomplishing this? I would like to have a check box in a form for each record that is returned from a query. That check box would then be used to identify records that would be appended to another table.
I've done this in the past for forms linked to temporary tables; however, since this form is linked to a query I think I'm having an issue.
You could add the checkbox to the form and use some VBA code to insert all those rows from the query into another table that have the checkbox checked (Forms!MyForm!myCb = True)

Querying Data Using Existing Spreadsheet

I have a spreadsheet that lists customers, their supervisor information, and special feature codes that are listed on their account at the time the report was created.
I need to add a column to this sheet that lists the last active date that these codes were populated on the customer account.
I'm aware of how pull the info when the features were last active. However, I need to base my query based on these specific accounts and codes. What family of SQL Clauses can I use to read these preexisting values and return a corresponding date value?
Your question is a bit ambiguous. How are you populating the spreadsheet? Are you using an ETL application like SSIS or creating an Excel output from a SQL query in your database?
If you are populating an existing Excel spreadsheet, then create in that spreadsheet a new column called "Last Active Date" in preparation for populating it from the source.
If you are pulling the data from a database source, then there may be an associated history or archive table where you can find the pre-existing codes along with their corresponding dates. Here your database administrator and/or developer will be better equiped to assist you in navigating the database architecture. If the codes are no longer available in the source database, then no special SQL CLAUSE will assist. You cannot retrieve that which does not exist.