Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enter PArameter Value? 1

Status
Not open for further replies.

detdu

Technical User
Joined
May 23, 2003
Messages
36
Location
SE
I´ve tried to search from combo boxes.. choose a value from the first.. and another from the second... and then gain a report based on what ive wanted... this I do from a command button.. the command button runs a query when i click on it and then its supposed to open a report... then a messagedialog comes up with.. enter parameter value... i press ok.. and ok again.. and a blank report comes up.. how come?
 
The parameter boxes are poping up becuase the data required is not available. Assuming you have the comboboxes that are supposed to feed the report on the same form, the query should contain the following in the criteria fields for the fiedls that need to be limited:

=Forms![formname]![comboboxname]

Then your command button just opens the report or runs the query and then opens the report as necessary

****************************
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, MCP, Network+, A+
w: robert.l.johnson.iii@citigroup.com
h: wildmage@tampabay.rr.com
 
ok... im new at this... so im sorry for my stupidity.. didnt mean to heart you with it :)

thx by the way
 
but still... doesnt work
 
Don't worry about being new...we've all been there.

Now, there has to be something else.....soemthing you just aren't seeing that is causing the error. Can you post the code for the command button and the SQL for the query????

****************************
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, MCP, Network+, A+
w: robert.l.johnson.iii@citigroup.com
h: wildmage@tampabay.rr.com
 
Private Sub Runquery_Click()
On Error GoTo Err_Runquery_Click

' set up constants and variables

Dim test As String

Const Uppkollningen = "acViewPreview"
Const Query = "SelectRelations"

' this is a query
' I am using a query to combine results
' from two linked tables

Const RName = "Report2"
' this is a report
' get the parameters from the combo boxes
test = "[SelectRelations].[Country] = '" & Me.CountryCombo & _
"' AND [SelectRelations].[Event] = '" & Me.EventCombo & "'"

' Open the report in preview mode

DoCmd.OpenReport _
Reportname:=RName, _
View:=acViewPreview, _
Filtername:=Query, _
WhereCondition:=test
Exit_Runquery_Click:
Exit Sub

Err_Runquery_Click:
MsgBox Err.Description
Resume Exit_Runquery_Click
End Sub


this is the code... Its two boxes.. one country and the other one event.. so.. this is for the command button... these are for the comboboxes rowsource
SELECT DISTINCTROW [tblCountry].[CountryID], [tblCountry].[Country] FROM tblCountry ORDER BY [Country];
and the same for event... now im stuck.. dont know what to do :/
 
OK...my first impression is you breakdown is here:

test = "[SelectRelations].[Country] = '" & Me.CountryCombo & _
"' AND [SelectRelations].[Event] = '" & Me.EventCombo & "'"


it should actually read:

test = "[SelectRelations].[Country] = '" & Me![CountryCombo] & _
"' AND [SelectRelations].[Event] = '" & Me![EventCombo] & "'"


Notice the changing of the dot (.) to bang (!) and the addition of the square brackets ([]).

This is a common mistake for newer individuals. Here's the logic for when to use bang and when to use dot and why.

Bang refers to a control on an object, dot refers to a property of the object. For example, if you have a textbox called txtName on a form called frmMain, to reference the text box you should use: Forms![frmMain]![txtName] To reference the pop-up property of the form frmMain you would use: Forms![frmMain].PopUp = True

As you can see, use bang for referencing most controls and use dot to call the property of the controls/forms....

****************************
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, MCP, Network+, A+
w: robert.l.johnson.iii@citigroup.com
h: wildmage@tampabay.rr.com
 
thanks for that too.. but its still the same problem :/ ive been with the same problem for about 5 hours now :/
 
Is it possible for you to zap me the database? I'll be happy to take a look and find the errant piece of code causing the problem. If so, please zip and send to my work address in my sig block.

****************************
Only two things are infinite, the universe and human stupidity,
and I'm not sure about the former. (Albert Einstein)

Robert L. Johnson III
MCSA, CNA, MCP, Network+, A+
w: robert.l.johnson.iii@citigroup.com
h: wildmage@tampabay.rr.com
 
am i supposed to do something specific in queries besides choosing the correct tables and what information i want to be seen.?
 
thx alot.. im sending it right now :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top