Why does this query ask for a parameter?

Mike1138

Board Regular
Joined
Jun 8, 2013
Messages
54
I posted a question yesterday about a problem I was having bringing the results of a query into Excel from Access. No solutions were found.

After doing some testing, I believe the problem may be with this subquery:

Code:
SELECT Max(O.ChngDate) 
FROM tblOSHAHistory AS O 
WHERE O.ClaimNum = tblOSHAHistory.ClaimNum

It asks me to enter a parameter for tblOSHAHistory.ClaimNum, despite the fact that I haven't assigned any parameters.

I'm an SQL novice, but I don't think I've missed anything here. My SQL produces the desired results in Access and returns a null set in Excel.
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Hi

Perhaps you are confusing it because you have assigned the table name tblOSHAHistory to O.

I suggest that you run a straight query like :-
Code:
"SELECT O.ClaimNum, O.OSHAStat, Max(O.ChngDate) " _
& "FROM tblOSHAHistory AS O " _
& "WHERE O.OSHAStat Like " & Chr(34) & "R*" & Chr(34) & " " _
& "ORDER BY O.ClaimNum "

hth
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,618
Members
449,092
Latest member
amyap

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