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

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

Related

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

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.

Updating information in an Access table linked to SharePoint

I have a table in Access linked to a SharePoint list. The table is comprised of about 15 fields whose contents are originally pulled from another data source (in Excel format). There are an additional 10 or so fields after the original 15 that make up a questionnaire (added via SharePoint) that contain answers to questions about the first 15 fields.
The data in the first 15 fields needs to be updated periodically when new data from my external source is available to download. A lot of the information will remain the same, however some of the fields within each of the rows will change and need to be updated. It is also important that the 10 fields that contain the questionnaire are not modified at all during this process.
Is there a way for me to easily update the cells that have changed using an Update query or something similar? The data does have a unique identifier column (ID NUMBER) that is present on the current SharePoint list and the external data source.
I was thinking from a logical standpoint to put the new external data into a table, find the ID Number in the SP list and new external data, compare the values in the rest of the row on the SP list to the row of the external data, and if a value is different update the cell with the value from the external data. Not sure how to accomplish this using Access queries though.
I really appreciate any help at all! If you need more information, please let me know. If you think there's a more logical way to do this, please let me know your feedback!!
Here's how to get started:
http://workerthread.wordpress.com/2009/02/03/using-access-2007-to-update-sharepoint-lists/
After you get the connection set up, it's just a matter of writing the queries correctly. If you need to run multiple queries periodically, you can setup a form with buttons, and attach some VBA code to the buttons that runs the queries.
MS Access - execute a saved query by name in VBA

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)

Access 2007 - drop down box in a Report

I need to create a drop-down box so that an employee can select a pre-set reason in the "RE:" field of a Report. There are only two selections that need to be in the box: "personal events" and "lack of adequate notice".
The report itself is already made and there are a number of fields that link back to the database - name, address, specific dates, etc that are already in the report. I've figured out how to make the drop-down box using the combo box function in a form but is there any way I can merge the combo box into the report?
I'm a beginner, by the way so I'm still figuring things out.
Currently your report sits on a query (query get relevant data from the table)
Steps to follow:-
Change the table by adding a column with the two options you just
mentioned above
Add combobox to Form with items as the two options
Adjust your query to use these options as a criteria to change
results returned by the query
Show the results in the report as you are showing right now.
If you have a code already, please post that snippet. So we can help you accordingly.
Some reference for you to get ideas
BUT I HAVE A DOUBT, ARE YOU TRYING TO SAY YOU WANT TO SWTICH BETWEEN TWO REPORTS BASED ON THE USER CHOICE SELECTED IN COMBOBOX?

Pre-Populating InfoPath using SQL Database

I am creating an InfoPath form and want to retrieve the data from the SQL database. I'm not looking for end users to fill in blank text fields, but rather am just wanting to populate the fields with the data from the SQL Database.
I have searched on some blogs and InfoPath/Microsoft sites to see how this can be accomplished, but many of the things I keep bumping into show how to create fields that the end user can populate instead of fields that are pre-populated.
I have already connected the database that I want to use to InfoPath and 'myfields' are already populated with the table that I am using, so half the battle has been won! :)
How can I accomplish this?
There are a few options available to you...
Firstly, you can look at using rules on the form load or default vlues in your InfoPath forms' fields to populate the fields with data from your SQL (secondary) data source... Take a look at this link here: http://social.technet.microsoft.com/Forums/en/sharepoint2010customization/thread/cb15a237-28cc-4d6b-8225-83181a7497ff
Secondly, you could use managed code on the form load to query the SQL database and then set your returned values to the values held in your fields in your InfoPath form. Take a look here for using managed code to do this: http://vspug.com/ssa/2006/01/03/populating-infopath-fields-with-sql-data-using-managed-code/
I hope this helps...