Yeah. Its a table with just "RegulationNumber" and "RegulationName"
:
Does table Regulations have a field named RegulationNumber?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
message
With this I get a popup box asking to "enter parameter value" for
RegulationNumber. If I cut and past a valid RegulationNumber, I
still
end
up
with an empty form.
It seems like there'd be a simple way to have it simply append the
report
for the one regulation.
:
I don't see the point of the GROUP BY clause. If you're trying to
eliminate
duplicates, just use
SELECT DISTINCT Regulations.RegulationName,
T_SIP_Revisions.FedApprovalDate,
T_SIP_Revisions.SubmitalDate, T_SIP_Revisions.[FR Number],
T_SIP_Revisions.[SR Date], T_SIP_Revisions.Description
FROM T_SIP_Revisions INNER JOIN (Regulations INNER JOIN
Revisions_Regs
ON
Regulations.RegID = Revisions_Regs.JRegID) ON T_SIP_Revisions.REVID
=
Revisions_Regs.JRevID
WHERE Regulations.RegulationNumber=[Forms]![frmByReg].[RegComboBox]
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
message
okay, here it is:
SELECT Regulations.RegulationName,
T_SIP_Revisions.FedApprovalDate,
T_SIP_Revisions.SubmitalDate, T_SIP_Revisions.[FR Number],
T_SIP_Revisions.[SR Date], T_SIP_Revisions.Description
FROM T_SIP_Revisions INNER JOIN (Regulations INNER JOIN
Revisions_Regs
ON
Regulations.RegID = Revisions_Regs.JRegID) ON
T_SIP_Revisions.REVID
=
Revisions_Regs.JRevID
WHERE
(((Regulations.RegulationNumber)=[Forms]![frmByReg].[RegComboBox]))
GROUP BY Regulations.RegulationName,
T_SIP_Revisions.FedApprovalDate,
T_SIP_Revisions.SubmitalDate, T_SIP_Revisions.[FR Number],
T_SIP_Revisions.[SR Date], T_SIP_Revisions.Description;
_____________________________________________
I've also tried:
SELECT Regulations.RegulationNumber, Regulations.RegulationName,
T_SIP_Revisions.FedApprovalDate, T_SIP_Revisions.SubmitalDate,
T_SIP_Revisions.[FR Number], T_SIP_Revisions.[SR Date],
T_SIP_Revisions.Description
FROM T_SIP_Revisions INNER JOIN (Regulations INNER JOIN
Revisions_Regs
ON
Regulations.RegID = Revisions_Regs.JRegID) ON
T_SIP_Revisions.REVID
=
Revisions_Regs.JRevID
WHERE
(((Regulations.RegulationNumber)=[Forms]![frmByReg].[RegComboBox]))
GROUP BY Regulations.RegulationNumber,
Regulations.RegulationName,
T_SIP_Revisions.FedApprovalDate, T_SIP_Revisions.SubmitalDate,
T_SIP_Revisions.[FR Number], T_SIP_Revisions.[SR Date],
T_SIP_Revisions.Description;
____________________
Which is only different in that I added a second "Regulation
Number"
criteria for the "Where" total.
It was a typo when I wrote Regualtion Number.
:
Chad's suggestion says "RegulationNumber", your reported error
message
says
"RegualtionNumber".
I really need to see the SQL of the query that the report's
using
(the
query
Chad worked on with you). To get to the SQL, open the query in
design
view,
then choose SQL View from the View menu.
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
in
message
The field is good as far as I can tell.
I'm running:
Private Sub OK_Click()
On Error GoTo Err_OK_Click
Dim stDocName As String
Dim stLinkCriteria As String
If Me.RegComboBox & "" <> "" Then
stDocName = "rptByReg "
DoCmd.OpenReport stDocName, acPreview
Else
MsgBox "You must select regulation for your reports.",
vbOKOnly,
"Selection Error"
End If
Exit_OK_Click:
Exit Sub
Err_OK_Click:
MsgBox Err.Description
Resume Exit_OK_Click
End Sub
---------------------------------------------
As suggested by Chad. With
Field: RegulationNumber
Table: Regulations
Total: Where
Criteria: [Forms]![Your Form Name].[MyComboBox]
in the reports query.
I've tried a few other things, and either get the error
message I
mentioned
earlier, or a prompt to select a parameter which will only
output
an
empty
report.
:
Did you mistype the name of the field? If not, what's the SQL
that's
being
run?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
"Andrew Hollis" <
[email protected]>
wrote
in
message
Got it.
Though now whenever I run the code, I get the error "You
tried
to
execute
a
query that does not include the specified expression
'RegualtionNumber'
as
part of an aggregate function."
And it reorders my original query.
:
Hopefully you realize that that's supposed to be on a
single
line.
If that's not the problem, what's the "trouble" you've
been
having?
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
"Andrew Hollis" <
[email protected]>
wrote
in
message
Sorry for the late response (been on holiday), but I'm
having
trouble
with
the statement:
MsgBox "You must select regulation for your
reports.",vbOKOnly,
"Selection Error"
in the code you suggested.
:
Sorry posted before I was finished. You then would use
something
like
this in
your reports query so all the info is base on the
selection
you
maade
in
your
forms MyComboBox.
Field: RegulationNumber
Table: Your Table
Total: Where
Criteria: [Forms]![Your Form Name].[MyComboBox]