Make Access Form Update With Buttons - database

I constructed an Access database for a group of end-users. This database is composed of one table, tblInventory, and several queries for them to edit their data quickly/easily. One of my queries, for example, is:
UPDATE tblInventory SET Amount = Amount-[Enter Amount]
WHERE ((([tblInventory].Equiptment_Name)=[Enter Name]));
This worked great in my opinion, but I have to please the end-user after all. They requested that I make a form and use buttons to update the data in the table for them. I have the form laid out like this:
The Equipment_Name and Amount boxes pull their information from my table, which has categories named that. My Unbound textbox field is where I would like them to be able to enter the number of the given part they would like to take out of inventory. The button should be to run my query above, but instead of prompting for inputs I would like it to use what they entered into the textbox. I've tried many different things and searched many different sites but cannot find what I'm looking for.
P.S Equiptment_Name and Amount are the only 2 datafields in the table besides other fields I have in the table to serve as more lenient ways to search for data when they entered in names. These fields are called things such as Alt_Name1 and have no real relevance to the form.
Thanks in advance for any help given.

There is a couple ways you can do it but the simplest way is:
Build your query as a predefined query(ies)
Build a Macro that disabled warnings then executes your query or queries in the order you wish to execute them.
Go to the form Define the button.
Go to the event tab.
Build an event
Set the OnClick Event to the name of the Macro.
Save and Test.

Related

SSRS Dynamic Reports for Key Value Pairs

I need to use SSRS to create many different reports, and I have been trying to find the best way for me to easily create them as need, and for users to navigate them and use them for their needs.
To give you and idea of the two sets of data I am dealing with:
EDI file from our customer
Raw data output from hardware configuration
Now the EDI data is fairly consistent, so these columns are static.
The hardware data is usually a massive list of different configuration. I receive them in different flat files formats and using SSIS or other tools I get the data into Key Value Pairs. Now in a report, I use matrix to keep EDI columns static, it matches with the hardware on serial number, and Hardware data pivots.
So the report does not break, and so I don't give the user too much information, it matches up on another table where I specify what keys I want to be columns.
Here is a small example of one of my reports:
The green columns are EDI, while the orange is the hardware.
My question is, is there a better way for me to be doing this? Some reports can get complicated like needing total for certain hardware (counting hardrive space, ram total etc.) which is difficult to do dynamically.
I have tried creating in reports in this fashion, with these parameters:
This way I can create the Key columns per project and user can select what report they want to run. The default is All Data.
Is there a better way for me to create these reports? SSRS really doesn't seem to play well with dynamic pivots.
Is there a better tool that will handle these reports dynamically, or let users pick and choose what they want to see in a report?
I can't visualise your data but if I understand correctly, you could have a dropdown list showing all the unique values that are in the column you are using in the column group. Set this to be multi-value and then simply have the WHERE clause read something like
SELECT * FROM myTable WHERE myColumnGroupField IN (#myColumnChoiceParameter)
This way the user could select whichever columns they would like.
You could extend this by adding another parameter that has some preset groups of columns (I think you might have one of these already if I understand correctly) that would set the default value of the main #myColumnChoiceParameter parameter.
If you want something more flexible then you might want to look at Power BI but depending on how you intend to deploy that might not be a simple option.
You cannot dynamically create columns in SSRS but you can control the visibility of the columns.
1) Create a list in table that contains the names of all the columns that yo want to toggle and include a column titled 'All'.
2) Create a parameter that is based on this table and make sure multi-select is turned on.
3) Right click on every column that you want to toggle, select visibility and then create a condition that checks if the user either selected All or selected the column from the parameter list.
4) Train users that by selecting and deselecting from the dropdown they control whats visible.

MS Access loading values from a different table to control source in datasheet form

please bear with me; I'm not particularly confident with MS Access, although I am quite experienced with SQL Databases from website work.
For my sins, I have been tasked with developing a database which will unify the hundreds of spreadsheets which we currently use to record details of our clients, work, and other stuff... The database is established and built, but I am now working with the forms to allow data entry.
I have a datasheet form (we have a member of admin staff who is hell-bent on refusing to use forms, so a datasheet form seems to be the best way to appease her!) and it is bound to a specific table ('referrals') to allow a user to input data into that table. It looks like this:
However, I need to be able to load values from another table ('pupil_details') into the 'UPN' field so that if a pupil already exists in the 'pupil_details' table, the user can pick that pupil and have their details automatically filled into the form for convenience.
The form's Record Source is currently:
SELECT referrals.*
FROM referrals;
The most obvious way to do this seemed at first to be to use a join query for the form's record source, along the lines of:
SELECT referrals.*, pupil_details.UPN
FROM referrals LEFT JOIN pupil_details ON referrals.UPN = pupil_details.pupil_id
and then use this as the control source but when I do this, it breaks the functionality of the form (displays all the records, prevents it being used to enter data)
So, can anybody suggest to me how I might be able to get the 'UPN' field to display a list of records based on this query when a user types into it:
SELECT pupil_details.UPN, pupil_details.name, pupil_details.date_of_birth FROM pupil_details
But then enter the details into the 'referrals' table when the user submits the form? Sort of like this that I mocked up in Photoshop:
I'm stumped, and half a day on Google has left me none the wiser... :(
Thanks!
You should use a continuous form, not a datasheet, it will give you a lot more control, but still look like Excel. Once you have the form, you can add a combobox to get the details you want. It is nearly always best to avoid Excel attitudes in Access.

Gather inserted text values from multiple rows in a report

I'm currently struggling with Oracle Apex.
I'm trying to create an application which enables customers to place their order. Therefore I create a report which lists the available products. Furthermore the report contains a column (the SQL query for that is simply '0' as "Quantity") which displays a text box. In this text boy the customer should be able to insert the required quantity.
I've create a screenshot to make it easier to follow me:
After the customer has fill out the form, the "Place Order" button will purchase the wished items then.
My question is now, how is it possible to read out in which text boxes did the user filled in a number and also to which product belongs it!
An easier solution would be to recreate the region but choose Form Region and then Tabular Form Region and then the wizard will help take care of the DML for you. But you need to use specific table columns for this to work.
To answer your question more directly - the input items defined in reports that are posted to the server can be accessed in PL/SQL as a set of "Global Arrays". These are defined as PL/SQL tables in the package apex_application with the names g_f01 through g_f50.
To be sure which of these arrays to use for the quantity text box you can look at the html of the page for the name attribute of the input tag. If it is f01 then you would be able to process the results by accessing each position or element in apex_application.g_f01.
To link the input with the table you would need some sort of key. If you use the wizard to build a Tabular Form all this headache is taken care of for you though.

SQL 2000, Access Query

I have a SQL database where one of my fields 'Status' has one of 10 entries in it (not from a dropdown list). I let some people have access to the data through an Access database, they can add and modify entries.
My question is, in Access, how can I make it so that the 'Status' field is a drop-down list from which the users can choose from (the 10 entries which are already in the SQL database)? It would be easier for them and also mean that mistakes cannot be made.
Many thanks
Scott
The usual way to do this is to use a combo box on a form with the row source taken from the look-up table and the bound column set to the field (column) of the table to be updated.
In Access you can add lookup information to a column. That will automatically display a dropdown list.
Step 1: Start the lookup wizard:
Step 2: After the wizard, the lookup settings should look like this:
Step 3: When your users open a table, they should see the dropdown box:
In addition to the solution described by Andomar you must not use another table as the source for your lookup. You can also provide the lookup-values in a list, which is hardcoded in the table-definition. This is fine for simple scenarios where the lookup is something that is not likely to be changed.
Several issues here:
table datasheets are not suitable user interface for users.
you can create a saved QueryDef and if you view the properties of a field, the second tab is just like the second tab in table design, and allows you to use a combo box as your display type in your query. I would generally recommend against this, as, like table datasheets, a QueryDef is not a proper UI element, and if you use the saved query in other queries, you can run into the same problems that cause lookups in table fields to be such as bad idea.
you're building a UI, so use the tools that Access provides you for building a UI. That means a form. Your form's recordsource would have the bare data, and you'd create a combo box on your form that is bound to the field in the table behind your form, and displays the values from the lookup tables. There's a wizard to step you through this. If you like the look of datasheets so much (column sizing, sorting, show/hiding are all features that are nice in datasheets), you can set your form to display as a datasheet.
My advice is that for building a user interface, use the tools Access provides for creating user interface. In my opinion, a dropdown list belongs in a form, and nowhere else. While I occasionally might add one to a query for quick-and-dirty editing, I would never do that in objects that users are going to use.

Dynamic selection of dataset in SSRS

I am going to design a report using SSRS 2005. Is it possible to have the selection of dataset done dynamically?
Let's say I am going to have two tables, where the first one is the summary and the second is the detail data. One of my parameters (with values Summary and Detail) will determine which version of the report is to be displayed. Can I have two different datasets, and while clicking the view report button in parameter view dialog (or before) set which dataset which will be used?
You can use the single data set by using switch statement some thing like this:
You can type this in data tab but the results can be seen only in preview tab, but not the data tab like regular queries.
=Switch(Parameters!ToDecide.Value = "Summary",
"Your query for Summary",
Parameters!ToDecide.Value = "Detail",
"Your query for Detail")
Make sure you don't have any excess spaces with in the query(not more than one space where needed)
Both the queries should return the values required by the Table in Layout.
You'll probably have to have 2 pairs of table contained in, say, a rectangle, and hide the unused one (at the container level). Or use subreports.
If you find a way to switch datasets, then you'll have to make sure that all columns are the same as well as making sure that any functions using the DataSet as a scope parameter are changed too... which makes me think it just isn't supported.
You might want to try using a single dataset and having a summary and detail data region (table, list, etc.) in the report, one of which is visible and one of which is not. In this scenario, the dataset is only evaluated once and you are still meet your requirement.
Hope this helps,
Bill
It would be easier to create and maintain if you have two separate tables and hide one or the other depending on the choice made.
I haven't tried this, but I think another possibility would be to use three reports: a container, a summary subreport, and a detail subreport. Switch between the subreports according to the choice.
There is a performance gotcha to the first implementation though. SSRS will try to fill every DataSet in the report when it loads, even ones that are not used in the report's output or by other DataSets or expressions. In other words, just because you're displaying the summary report, doesn't mean that you're not asking the database to fill out your detail data as well.
There is a workaround that can improve the performance a bit, but will still end up with a trip to the server. The hack is to set a flag parameter to determine whether or not the query should actually return any real results or if it should just return the columns you want.
You may try adding condition that depends on a cetain parameter to execute. Then from there, You may use different data set. Assuming that you'll use it on separate hidden tablix.

Resources