Query Help

NavyJoe

Board Regular
Joined
Sep 14, 2004
Messages
63
I want to run a query on a table. I want the query to find the most recent record put into the database (this is for a special form). I'm using an Autonumber as the primary key. What do I need to put in the Criteria for the Autonumber field?
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi,

if I am right then you want to get the field with the highest autovalue.

There are more possible ways to do it.
I would prefer this SQL-Statement:

SELECT *
FROM

WHERE [autovalue]=DMAX("[autovalue]","
");

You have to replace
with the table-name and [autovalue] with the column-name.
 
Upvote 0
I figured that one out right after I posted. There's a little drop down menu that says ALL in the toolbar. That is the "TopValues" statement. Make it 1.

I do have another question:

I have a report that has an unbound box. I went into the properties and made the control source =[Award Log Query]!Processor. Yet when I run the query and open up the Form, it just says #NAME?...Why is that. Did I do something wrong?
 
Upvote 0
Can you post more details of your problem?

I am not sure if I understood you right. But I think you have to put the query in the RecordSource of the form. In the control source you only put the name of the requested column.
 
Upvote 0
I have a report titled SSS. It's a hand created report (not bound to any query or table). One of the textboxes, I made the control source to equal what is in the Processer Field in the Award Log Query (which is a topvalue query for the table Award Log Table). But the textbox (text171) just returns #NAME?. Is there something wrong?

Control Source: =[Award Log Query]!Processor
 
Upvote 0
As I said above, I think that you cant set a query in a control source. The query must be in the record source of your form and then you set the requested column-name into the control source.
 
Upvote 0

Forum statistics

Threads
1,221,838
Messages
6,162,286
Members
451,759
Latest member
damav78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top