473,394 Members | 1,759 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to create a form based on Summary Query

10
I'm trying to create an editable form of fulfilled orders on my system and am running into problems with creating a form based on this query. The field that I need to update (invoice number) is read-only. I DO understand the reasons for this:

The query takes information from an orders table and a transactions table which have a one to many relationship. I don't want to use any of the transaction fields, but I do need to use a query based on the transactions in an order to filter the order numbers displayed on the form. This summary will tell me all of the fulfilled orders (ie when Quantity Ordered - Quantity Delivered = 0).

I want to create a form based on the above Query but can't seem to do it. I want the final fields of the form to contain: CustomerID, OrderID, PO_Number, InvoiceNumber - all of which are on the orders table, and none of which are on the transactions list

I understand that a query with a 'group by' property is read only, but is there any way to - for example - filter the form results based on this query, or use VBA to get around this.

Sorry if my explanations here aren't so clear, but I'm fairly new to the access terminology, hence the occasional 'whatsitcalled' usage. Thanks in advance!

Any ideas, workarounds?
May 5 '10 #1
15 4398
NeoPa
32,556 Expert Mod 16PB
I think your own suggestion seems to be the best idea. You can use the complex, non-updatable, GROUP BY query to filter a simpler form bound directly to the table.

Another suggestion, if no aggregation is required, but only reducing the output to a single record for each grouped item, is to use the DISTINCT predicate. Thay may be more fiddly, depending on exactly what you're trying to do.
May 5 '10 #2
jt196
10
Hmm not sure if if I've explained myself correctly here. For an order to qualify as fulfilled, there needs to be a minimum of two items on the transaction table.

1 - the order coming in (and the quantity ordered)
2 - the delivery going out (and an equal quantity going out).

So I have one query that takes a summary of all of the same items on an order (order or delivery) and totals up the difference. I have a query that only includes items which have a difference of zero (meaning they are fulfilled).

I want to base a form on the orders that are on this query - but am having a hard time because it is based on a query that uses summing - even though the fields I'm using are not actually included in the summary.

Hope this clears my question up!

JT
May 5 '10 #3
NeoPa
32,556 Expert Mod 16PB
Well, the second suggestion is almost certainly not going to be of any use to you, but can you tell me why you believe the first doesn't appear to be of use.
May 5 '10 #4
jt196
10
@NeoPa
Hi NeoPa - well I probably should have said - I've only been a user of Access for a few weeks.

I've done the group by query and that's working fine, but I'm stuck at getting the form to be filtered by it. If I use the query as a data source, the records aren't updateable. How exactly do I use the query to filter the records in the form?
May 6 '10 #5
NeoPa
32,556 Expert Mod 16PB
In your code you open the form using :
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm(FormName, FilterName, ...)
Check in the help (Press F1 with the cursor on the OpenForm bit) for the specifications for the FilterName querydef. This would be the non-updatable GROUP BY query. The RecordSource of the form would then be a simpler reference to the table itself.

Disclaimer:
I've never used this method myself as I've never had a similar requirement, but I've noticed it there before, and I believe it should allow you to do what you want.

Let us know how you get on and Welcome to Bytes!
May 6 '10 #6
jt196
10
@NeoPa
OK so I've tried this filter and it seems to just pull up all of the records rather than filtering out the ones on the query.

Is it possible I need to place a WHERE Condition in the next space, ie where [OrderID] = [QOrdersNotInvoiced].[OrderID]. I've tried that and it just seems to come give me a box asking for the '[QOrdersNotInvoiced].[OrderID]' number.

Any hints?
May 7 '10 #7
NeoPa
32,556 Expert Mod 16PB
If your filtering is as simple as that then certainly. Don't even worry about a WHERE clause. Simply pass a filter in the WhereCondition parameter. I understood from your earlier posts though, that it wasn't that simple. In fact, that it needed to match the results of your GROUP BY query.

If it can be specified in the WhereCondition parameter then clearly this is a much simpler issue.
May 7 '10 #8
jt196
10
So the QOrdersNotInvoiced is the query with the GroupBy results in and that's the one that isn't editable. That query contains results from tables 'Orders' and 'Transactions' - summarising the results of transactions per order.

If use the command:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenForm FOrdersNotInvoiced, , QOrdersNotInvoiced
All that is presented to me is a list of ALL of the orders on the Orders table.
May 7 '10 #9
NeoPa
32,556 Expert Mod 16PB
I've no idea why you have used two commas (,) between your parameters. In post #6 I give both the name of the parameter and the position. As you have put the parameter in the wrong position and without a name it is clear that it will not work. I must admit I haven't any experience of getting it to work myself, but from the Help system I suggested something that should work. Why don't you try it again with either the parameter in the second position, or with the parameter named. Either should ensure it is used as you need it to be.
May 7 '10 #10
jt196
10
NeoPa - was just following the instructions on here:

http://www.datawright.com.au/access_..._arguments.htm

The openform command is thus:

DoCmd.OpenForm FormName, View, FilterName, WhereCondition, DataMode, WindowMode, OpenArgs

So the empty space between the commas was just a default value for 'View'.
May 7 '10 #11
I don't understand why you would want to update that kind of info. When I need to see this kind of info I usually just make a report. What is there to update?

Evy
May 7 '10 #12
jt196
10
Hey there - no problems it's all sorted. I've made a form that uses a combo box to choose the information.

As for the need, well the system works like this:

INCOMING ORDER --> Items on TOrders + Items on TTransactions (including QuantityOrdered)

PART OR ALL ORDER GETS SHIPPED OUT --> New Delivery Note + New Items on TTransactions (the new transactions items have a delivery note ID and an order ID attached to them - and a number in the QuantityDelivered field)

When an order is fulfilled, the totals columns for all items against an order - will be zero and therefore qualify to be on this QOrdersNotInvoiced query. So each item on the order may have multiple deliveries and therefore multiple entries on the order. That means that I needed to take a sum of all of these items as part of a query so I know what's ready to be invoiced.

At the end of it all, I wanted a form that would give me quick access to all of the fulfilled orders that hadn't been invoiced - that way I could input them into Sage and go back into Access and quickly give each order an Invoice number.

This is an interim solution until I can figure out how to export these orders into Sage once a week.

It may seem all a bit long-winded, but I wanted to move the office tasks away from the factory tasks and keep them separate. This way, once a week, I sit down and do all the week's invoices without them coming up and bugging me for delivery notes (because I'll have moved away from the area by then and be working remotely), to keep track of all the outstanding orders and finally, for the factory can have a work schedule of incomplete orders.

Hope that all makes sense - if you can see of an amazingly way to manage the partial order fulfillment process then I'd be happy to hear it. I'm a complete beginner to access and have only been working with it (albeit feverishly) for the last couple of weeks.
May 7 '10 #13
NeoPa
32,556 Expert Mod 16PB
jt196: NeoPa - was just following the instructions on here:
I beg your pardon. I checked but misread the order - both in my earlier post and when I rechecked it after your post. Your extra comma (,) is absolutely right, and the names are not necessary as long as the order is correct.

Sorry for the confusion.
May 7 '10 #14
NeoPa
32,556 Expert Mod 16PB
jt196: Hey there - no problems it's all sorted. I've made a form that uses a combo box to choose the information.
I'm very pleased to hear it :)

I'm sorry my directions weren't much help to you in the end, but impressed that you managed to resolve it in spite of that.

Good for you!
May 7 '10 #15
jt196
10
Yeah like I said - did a bit of a work around so now instead of having a form with a list of the invoice numbers that need inputting, I have a form with the order details and a combo box based on the query that updates the information in the form. More or less the same - guess it's a little less quick entering the information but at the amount of orders we have on our system, it's not the end of the world... Hopefully by that time arrives, we'll have full Sage import going on...

Cheers anyway!
May 7 '10 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David Boone | last post by:
Please excuse the newbie questions, but I'm fairly new to Access though familiar with databases in general (experience with MySQL and PostgreSQL). The basic idea is that there is table of...
3
by: Mike | last post by:
Is it possible to create and display a form based on a string variable that will be set at run-time? In other words, instead of declaring a variable as a user-defined form class: Dim MyForm...
4
by: john | last post by:
I created a form via the wizard with 1 main table and 2 one-on-one tables. As i couldn't add a field to the form (a field that I added to the table after creating the form), I googled out that the...
1
by: Newbie | last post by:
I am pretty new to Access Reports. I used the wizard to write a detail report that works well. In the group footer, I would like to show the totals for each column in my report. So, I wrote...
4
by: Deus402 | last post by:
Here is my table design: tblEmployers EmployerID autonum (primary key) EmployerName text tblLocations LocationID autonum (primary key) EmployerID longint (foreign key) LocationAdress text
5
by: SeanCly10 | last post by:
Hi all. I don't want to sound like a complete idiot here, but I'm somewhat limited in my coding knowledge, and I need some advice and help. I'm working on a database that will eventually be used...
1
by: starke1120 | last post by:
Is there a way to open a form based on query type.. Example.. If a certain query result is 1 then open the form to this result.. If the query results are NULL or 0 results, then open open for...
2
by: PaulaCM | last post by:
Is there a way to create a Form based on a Query? Everyone in my database has a staff point person assigned to them. I've created a query for each person where they can find only their contacts. ...
1
by: MikeMikerson | last post by:
Hello, I am need to create a subform (no problem) of a form based query (a problem). I need a form that will prompt the user to enter in a name, and the form will then display a query of the...
8
by: serhii7777 | last post by:
Hello, I am building a database that keeps track of some events. I need to plot the events on a map. In other words, a query returns a number - digit, the number of incidents of a particular kind. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.