How to creat a Query in Code

A

Ayo

I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
D

Douglas J. Steele

There was no need to start a new thread when your previous one was still
being worked.
 
J

John O. Graybill

Hi Ayo:

No guarantees, but take a look at following code and see if it gives
you any ideas:

Private Sub cmdVendor_Reviewer_Report_Click()

Dim DB As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strVendorName As String
Dim strMarketReviewer As String

strVendorName = Forms![Select Vendor and Reviewer]!
cmbVendorName.Value
strMarketReviewer = Forms![Select Vendor and Reviewer]!
cmbMarketReviewer.Value

Set DB = CurrentDb

strSQL = "SELECT [Invoice Tracker].* "
strSQL = strSQL & "FROM [Invoice Tracker] "
strSQL = strSQL & "WHERE ((([Invoice Tracker].Vendor = " & "'" &
strVendorName & "'" & ") AND "
strSQL = strSQL & "(([Invoice Tracker].Market Reviewer)= " & "'" &
strMarketReviewer & "'" & "));"

Set rst = DB.OpenRecordset(strSQL, dbOpenDynaset)

' *** Read the recordset values and
' *** do with them as you please.

rst.Close

Set rst = Nothing
Set DB = Nothing

End Sub


John
 
K

Ken Sheridan

As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England
 
A

Ayo

Thanks John.
But I am still getting an error, Run-Time Error '3061': "Too few
parameters. Expected 2."
What do you suppose this means?
 
A

Ayo

Sorry Douglas. I was getting desperate when I didn't getting any response for
a while.

Douglas J. Steele said:
There was no need to start a new thread when your previous one was still
being worked.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ayo said:
I am looking to create a query in VBA code using values from ComboBoxes on
a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out
what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" &
_
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
A

Ayo

Thanks. I will try this. Looks like what I was really looking for.

Ken Sheridan said:
As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

Ayo said:
I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
A

Ayo

How do I go about "saving the query with the reference to the controls on the
form as parameters"

Ken Sheridan said:
As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

Ayo said:
I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
K

Ken Sheridan

In query design view add the [Invoice Tracker] table to the query, and then
add the asterisk to the first column of the design grid so it returns all
fields. Then add the [vendor] and [market reviewer] fields to the second and
third columns in the design grid and uncheck their 'show' checkboxes. In the
'criteria' row of the [vendor] column put Forms![Select Vendor and
Reviewer]![cmbVendorName] and in the 'criteria' row of the [market reviewer]
column put Forms![Select Vendor and Reviewer]![cmbMarketReviewer]. Save the
query under a suitable name.

Design the report (you can use the report wizard for this if you wish) and
use the name of query you created as its RecordSource property. If you use
the wizard you'll simply select the query from a list.

To open the report you could put a button on the [Select Vendor and
Reviewer] form. You can use the button wizard to generate the code in its
Click event if you wish, or you can write it yourself. When the button is
clicked the report will open filtered to the vendor and market reviewer
selected in the combo boxes. You might want two buttons in fact, one to
preview the report and one to print it.

BTW I notice that in my last reply I didn't enclose the name of the Market
Reviewer column in brackets in the SQL statement. As it contains a space it
needs these, so should have been [Market Reviewer]. When you design a query
in design view, however, Access will automatically put brackets around all
object names, so you don't have to remember to do this as you would if
writing the query in SQL view.

Ken Sheridan
Stafford, England

Ayo said:
How do I go about "saving the query with the reference to the controls on the
form as parameters"

Ken Sheridan said:
As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

Ayo said:
I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
A

Ayo

Thanks a lot Ken. I believe I am getting close but not quite there yet. I did
as you instructed and then I placed this code in the button click event:

Private Sub cmdVendor_Reviewer_Report_Click()
DoCmd.OpenReport "Reviewer by Vendor", acViewPreview, "Reviewer by
Vendor"
End Sub

Now I am getting this error massage: Run-time error '3066', "Query must
have at least one destination field." I don't know what that means.

Ayo


Ken Sheridan said:
In query design view add the [Invoice Tracker] table to the query, and then
add the asterisk to the first column of the design grid so it returns all
fields. Then add the [vendor] and [market reviewer] fields to the second and
third columns in the design grid and uncheck their 'show' checkboxes. In the
'criteria' row of the [vendor] column put Forms![Select Vendor and
Reviewer]![cmbVendorName] and in the 'criteria' row of the [market reviewer]
column put Forms![Select Vendor and Reviewer]![cmbMarketReviewer]. Save the
query under a suitable name.

Design the report (you can use the report wizard for this if you wish) and
use the name of query you created as its RecordSource property. If you use
the wizard you'll simply select the query from a list.

To open the report you could put a button on the [Select Vendor and
Reviewer] form. You can use the button wizard to generate the code in its
Click event if you wish, or you can write it yourself. When the button is
clicked the report will open filtered to the vendor and market reviewer
selected in the combo boxes. You might want two buttons in fact, one to
preview the report and one to print it.

BTW I notice that in my last reply I didn't enclose the name of the Market
Reviewer column in brackets in the SQL statement. As it contains a space it
needs these, so should have been [Market Reviewer]. When you design a query
in design view, however, Access will automatically put brackets around all
object names, so you don't have to remember to do this as you would if
writing the query in SQL view.

Ken Sheridan
Stafford, England

Ayo said:
How do I go about "saving the query with the reference to the controls on the
form as parameters"

Ken Sheridan said:
As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

:

I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
K

Ken Sheridan

Ayo:

It sounds like you might have unchecked the 'show' box for all the columns
in design view. What you should have in query design view is one column with
the asterisk in its 'field' row and its 'show' box CHECKED, and [Vendor] and
[Market Reviewer] in the 'field' rows of two other columns each with their
'show' box UNCHECKED and the references to the combo boxes in their
'criteria' rows.

Also, as the report is based on the query you don't need the 'filter'
argument when opening it; the references to the combo boxes in the query
provide the filtering. The following will do:

DoCmd.OpenReport "Reviewer by Vendor", acViewPreview

Ken Sheridan
Stafford, England

Ayo said:
Thanks a lot Ken. I believe I am getting close but not quite there yet. I did
as you instructed and then I placed this code in the button click event:

Private Sub cmdVendor_Reviewer_Report_Click()
DoCmd.OpenReport "Reviewer by Vendor", acViewPreview, "Reviewer by
Vendor"
End Sub

Now I am getting this error massage: Run-time error '3066', "Query must
have at least one destination field." I don't know what that means.

Ayo


Ken Sheridan said:
In query design view add the [Invoice Tracker] table to the query, and then
add the asterisk to the first column of the design grid so it returns all
fields. Then add the [vendor] and [market reviewer] fields to the second and
third columns in the design grid and uncheck their 'show' checkboxes. In the
'criteria' row of the [vendor] column put Forms![Select Vendor and
Reviewer]![cmbVendorName] and in the 'criteria' row of the [market reviewer]
column put Forms![Select Vendor and Reviewer]![cmbMarketReviewer]. Save the
query under a suitable name.

Design the report (you can use the report wizard for this if you wish) and
use the name of query you created as its RecordSource property. If you use
the wizard you'll simply select the query from a list.

To open the report you could put a button on the [Select Vendor and
Reviewer] form. You can use the button wizard to generate the code in its
Click event if you wish, or you can write it yourself. When the button is
clicked the report will open filtered to the vendor and market reviewer
selected in the combo boxes. You might want two buttons in fact, one to
preview the report and one to print it.

BTW I notice that in my last reply I didn't enclose the name of the Market
Reviewer column in brackets in the SQL statement. As it contains a space it
needs these, so should have been [Market Reviewer]. When you design a query
in design view, however, Access will automatically put brackets around all
object names, so you don't have to remember to do this as you would if
writing the query in SQL view.

Ken Sheridan
Stafford, England

Ayo said:
How do I go about "saving the query with the reference to the controls on the
form as parameters"

:

As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

:

I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
A

Ayo

Thank you so much Ken. You have been a great help. If I could trouble you
with one more thing, if you don't mind of course. I have an issue I can't
understand. I created 2 forms, one is called "Invoice Tracker Reports" and
the other is called "Report Page Setup".
On "Invoice Tracker Reports": I have 2 buttons. All Vendors Report and All
Reviewers Report.
On "Report Page Setup": I have an Option group with 2 option buttons.
Portrait and Lanscape.
My intent is to have someone select a button on the Invoice Tracker Reports
form and that will open the Report Page Setup form. If you then select an
option button in the Report Page Setup form, the report will open based on
the orientation you choosed.
Everything works fine up to the point wher you select the option button on
the Report Page Setup form. When I select an option nothing happens. It just
doesn't do anything. I have enclosed the codes for both forms, see if you can
find out what I am doing wrong.
Thanks again for all your help.
Ayo

Invoice Tracker Reports Form Code:
Private Sub AllReveiwerReport_Click()
Dim allReviewerReport As String
DoCmd.OpenForm "Report Page Setup", acNormal, , , , acDialog,
OpenArgs:="allReviewerReport"
DoCmd.Close acForm, "Invoice Tracker Reports", acSaveYes
'DoCmd.OpenReport "Reviewer Report", acViewPreview
End Sub

Private Sub AllVendorReport_Click()
Dim allVendorerReport As String
DoCmd.OpenForm "Report Page Setup", acNormal, , , , acDialog,
OpenArgs:=AllVendorReport
'DoCmd.OpenReport "Vendor Report", acViewPreview
End Sub

Report Page Setup Form Code:
Private Sub Form_Load()
Dim option_AllReviewerReport As String
Dim option_AllVendorReport As String
option_AllReviewerReport = Me.OpenArgs
End Sub

Private Sub optLandscape_GotFocus()
If option_AllReviewerReport = Me.OpenArgs Then
DoCmd.Close acForm, "Report Page Setup", acSaveYes
DoCmd.OpenReport "Reviewer Report Landscape", acViewPreview
End If
End Sub

Private Sub optPortrait_GotFocus()
If option_AllReviewerReport = Me.OpenArgs Then
DoCmd.Close acForm, "Report Page Setup", acSaveYes
DoCmd.OpenReport "Reviewer Report", acViewPreview
End If
End Sub
Ken Sheridan said:
Ayo:

It sounds like you might have unchecked the 'show' box for all the columns
in design view. What you should have in query design view is one column with
the asterisk in its 'field' row and its 'show' box CHECKED, and [Vendor] and
[Market Reviewer] in the 'field' rows of two other columns each with their
'show' box UNCHECKED and the references to the combo boxes in their
'criteria' rows.

Also, as the report is based on the query you don't need the 'filter'
argument when opening it; the references to the combo boxes in the query
provide the filtering. The following will do:

DoCmd.OpenReport "Reviewer by Vendor", acViewPreview

Ken Sheridan
Stafford, England

Ayo said:
Thanks a lot Ken. I believe I am getting close but not quite there yet. I did
as you instructed and then I placed this code in the button click event:

Private Sub cmdVendor_Reviewer_Report_Click()
DoCmd.OpenReport "Reviewer by Vendor", acViewPreview, "Reviewer by
Vendor"
End Sub

Now I am getting this error massage: Run-time error '3066', "Query must
have at least one destination field." I don't know what that means.

Ayo


Ken Sheridan said:
In query design view add the [Invoice Tracker] table to the query, and then
add the asterisk to the first column of the design grid so it returns all
fields. Then add the [vendor] and [market reviewer] fields to the second and
third columns in the design grid and uncheck their 'show' checkboxes. In the
'criteria' row of the [vendor] column put Forms![Select Vendor and
Reviewer]![cmbVendorName] and in the 'criteria' row of the [market reviewer]
column put Forms![Select Vendor and Reviewer]![cmbMarketReviewer]. Save the
query under a suitable name.

Design the report (you can use the report wizard for this if you wish) and
use the name of query you created as its RecordSource property. If you use
the wizard you'll simply select the query from a list.

To open the report you could put a button on the [Select Vendor and
Reviewer] form. You can use the button wizard to generate the code in its
Click event if you wish, or you can write it yourself. When the button is
clicked the report will open filtered to the vendor and market reviewer
selected in the combo boxes. You might want two buttons in fact, one to
preview the report and one to print it.

BTW I notice that in my last reply I didn't enclose the name of the Market
Reviewer column in brackets in the SQL statement. As it contains a space it
needs these, so should have been [Market Reviewer]. When you design a query
in design view, however, Access will automatically put brackets around all
object names, so you don't have to remember to do this as you would if
writing the query in SQL view.

Ken Sheridan
Stafford, England

:

How do I go about "saving the query with the reference to the controls on the
form as parameters"

:

As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

:

I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
K

Ken Sheridan

Ayo:

Firstly I'd create two versions of each report one in portrait format and
one in landscape, which I think is what you have in fact done. You can
create one in one format and then save it as another version under a
different name using the 'Save As' menu option, and amend its layout to the
other format. This is simpler than trying to amend the page layout of a
single report each time at runtime.

I'd be inclined to simplify things by putting the option group on the
Invoice Tracker Reports form and do without the Report Page Setup form
altogether. A two-button option group doesn't really need a separate form of
its own I'd have thought. Then in the buttons' Click events you'd open one
or other of the reports depending on the option selected. Option groups have
numeric values so lets assume the option for portrait format is 1 and for
landscape 2 (if you use the wizard to create the option group this gives you
the opportunity to select the numbers to use).

If we assume the option group is named optFormat the code for the Click
event of the button to open the Reviewer report would then go something like
this:

Dim strReport As String

Select Case Me.optFormat
Case 1
strReport = "Reviewer Report Portrait"
Case 2
strReport = "Reviewer Report Landscape"
End Select

DoCmd.OpenReport strReport, acViewPreview

Do the same for the Vendor report.

I haven't analysed your code in detail but I notice that you are declaring a
variable allVendorReport and then seem to be passing this via the OpenArgs
mechanism (they are actually spelt differently in your code, but I assume
this is a typo). However, you are not assigning any value to the variable
so, even without the typo, a zero-length string will be passed.

Also you only need the acSaveYes option if you have amended the design of a
form in code, i.e. you've opened it in design view and amended its
properties. Simply close it otherwise.

Ken Sheridan
Stafford, England

Ayo said:
Thank you so much Ken. You have been a great help. If I could trouble you
with one more thing, if you don't mind of course. I have an issue I can't
understand. I created 2 forms, one is called "Invoice Tracker Reports" and
the other is called "Report Page Setup".
On "Invoice Tracker Reports": I have 2 buttons. All Vendors Report and All
Reviewers Report.
On "Report Page Setup": I have an Option group with 2 option buttons.
Portrait and Lanscape.
My intent is to have someone select a button on the Invoice Tracker Reports
form and that will open the Report Page Setup form. If you then select an
option button in the Report Page Setup form, the report will open based on
the orientation you choosed.
Everything works fine up to the point wher you select the option button on
the Report Page Setup form. When I select an option nothing happens. It just
doesn't do anything. I have enclosed the codes for both forms, see if you can
find out what I am doing wrong.
Thanks again for all your help.
Ayo

Invoice Tracker Reports Form Code:
Private Sub AllReveiwerReport_Click()
Dim allReviewerReport As String
DoCmd.OpenForm "Report Page Setup", acNormal, , , , acDialog,
OpenArgs:="allReviewerReport"
DoCmd.Close acForm, "Invoice Tracker Reports", acSaveYes
'DoCmd.OpenReport "Reviewer Report", acViewPreview
End Sub

Private Sub AllVendorReport_Click()
Dim allVendorerReport As String
DoCmd.OpenForm "Report Page Setup", acNormal, , , , acDialog,
OpenArgs:=AllVendorReport
'DoCmd.OpenReport "Vendor Report", acViewPreview
End Sub

Report Page Setup Form Code:
Private Sub Form_Load()
Dim option_AllReviewerReport As String
Dim option_AllVendorReport As String
option_AllReviewerReport = Me.OpenArgs
End Sub

Private Sub optLandscape_GotFocus()
If option_AllReviewerReport = Me.OpenArgs Then
DoCmd.Close acForm, "Report Page Setup", acSaveYes
DoCmd.OpenReport "Reviewer Report Landscape", acViewPreview
End If
End Sub

Private Sub optPortrait_GotFocus()
If option_AllReviewerReport = Me.OpenArgs Then
DoCmd.Close acForm, "Report Page Setup", acSaveYes
DoCmd.OpenReport "Reviewer Report", acViewPreview
End If
End Sub
Ken Sheridan said:
Ayo:

It sounds like you might have unchecked the 'show' box for all the columns
in design view. What you should have in query design view is one column with
the asterisk in its 'field' row and its 'show' box CHECKED, and [Vendor] and
[Market Reviewer] in the 'field' rows of two other columns each with their
'show' box UNCHECKED and the references to the combo boxes in their
'criteria' rows.

Also, as the report is based on the query you don't need the 'filter'
argument when opening it; the references to the combo boxes in the query
provide the filtering. The following will do:

DoCmd.OpenReport "Reviewer by Vendor", acViewPreview

Ken Sheridan
Stafford, England

Ayo said:
Thanks a lot Ken. I believe I am getting close but not quite there yet. I did
as you instructed and then I placed this code in the button click event:

Private Sub cmdVendor_Reviewer_Report_Click()
DoCmd.OpenReport "Reviewer by Vendor", acViewPreview, "Reviewer by
Vendor"
End Sub

Now I am getting this error massage: Run-time error '3066', "Query must
have at least one destination field." I don't know what that means.

Ayo


:

In query design view add the [Invoice Tracker] table to the query, and then
add the asterisk to the first column of the design grid so it returns all
fields. Then add the [vendor] and [market reviewer] fields to the second and
third columns in the design grid and uncheck their 'show' checkboxes. In the
'criteria' row of the [vendor] column put Forms![Select Vendor and
Reviewer]![cmbVendorName] and in the 'criteria' row of the [market reviewer]
column put Forms![Select Vendor and Reviewer]![cmbMarketReviewer]. Save the
query under a suitable name.

Design the report (you can use the report wizard for this if you wish) and
use the name of query you created as its RecordSource property. If you use
the wizard you'll simply select the query from a list.

To open the report you could put a button on the [Select Vendor and
Reviewer] form. You can use the button wizard to generate the code in its
Click event if you wish, or you can write it yourself. When the button is
clicked the report will open filtered to the vendor and market reviewer
selected in the combo boxes. You might want two buttons in fact, one to
preview the report and one to print it.

BTW I notice that in my last reply I didn't enclose the name of the Market
Reviewer column in brackets in the SQL statement. As it contains a space it
needs these, so should have been [Market Reviewer]. When you design a query
in design view, however, Access will automatically put brackets around all
object names, so you don't have to remember to do this as you would if
writing the query in SQL view.

Ken Sheridan
Stafford, England

:

How do I go about "saving the query with the reference to the controls on the
form as parameters"

:

As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

:

I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
A

Ayo

Thank you so much Ken. You are a real life saver. I will be seeking your
expertise again real soon. I am moving along slowly but surely. I need to
finish this all by Friday, the 30th.
Thanks once again.

Ayo

Ken Sheridan said:
Ayo:

Firstly I'd create two versions of each report one in portrait format and
one in landscape, which I think is what you have in fact done. You can
create one in one format and then save it as another version under a
different name using the 'Save As' menu option, and amend its layout to the
other format. This is simpler than trying to amend the page layout of a
single report each time at runtime.

I'd be inclined to simplify things by putting the option group on the
Invoice Tracker Reports form and do without the Report Page Setup form
altogether. A two-button option group doesn't really need a separate form of
its own I'd have thought. Then in the buttons' Click events you'd open one
or other of the reports depending on the option selected. Option groups have
numeric values so lets assume the option for portrait format is 1 and for
landscape 2 (if you use the wizard to create the option group this gives you
the opportunity to select the numbers to use).

If we assume the option group is named optFormat the code for the Click
event of the button to open the Reviewer report would then go something like
this:

Dim strReport As String

Select Case Me.optFormat
Case 1
strReport = "Reviewer Report Portrait"
Case 2
strReport = "Reviewer Report Landscape"
End Select

DoCmd.OpenReport strReport, acViewPreview

Do the same for the Vendor report.

I haven't analysed your code in detail but I notice that you are declaring a
variable allVendorReport and then seem to be passing this via the OpenArgs
mechanism (they are actually spelt differently in your code, but I assume
this is a typo). However, you are not assigning any value to the variable
so, even without the typo, a zero-length string will be passed.

Also you only need the acSaveYes option if you have amended the design of a
form in code, i.e. you've opened it in design view and amended its
properties. Simply close it otherwise.

Ken Sheridan
Stafford, England

Ayo said:
Thank you so much Ken. You have been a great help. If I could trouble you
with one more thing, if you don't mind of course. I have an issue I can't
understand. I created 2 forms, one is called "Invoice Tracker Reports" and
the other is called "Report Page Setup".
On "Invoice Tracker Reports": I have 2 buttons. All Vendors Report and All
Reviewers Report.
On "Report Page Setup": I have an Option group with 2 option buttons.
Portrait and Lanscape.
My intent is to have someone select a button on the Invoice Tracker Reports
form and that will open the Report Page Setup form. If you then select an
option button in the Report Page Setup form, the report will open based on
the orientation you choosed.
Everything works fine up to the point wher you select the option button on
the Report Page Setup form. When I select an option nothing happens. It just
doesn't do anything. I have enclosed the codes for both forms, see if you can
find out what I am doing wrong.
Thanks again for all your help.
Ayo

Invoice Tracker Reports Form Code:
Private Sub AllReveiwerReport_Click()
Dim allReviewerReport As String
DoCmd.OpenForm "Report Page Setup", acNormal, , , , acDialog,
OpenArgs:="allReviewerReport"
DoCmd.Close acForm, "Invoice Tracker Reports", acSaveYes
'DoCmd.OpenReport "Reviewer Report", acViewPreview
End Sub

Private Sub AllVendorReport_Click()
Dim allVendorerReport As String
DoCmd.OpenForm "Report Page Setup", acNormal, , , , acDialog,
OpenArgs:=AllVendorReport
'DoCmd.OpenReport "Vendor Report", acViewPreview
End Sub

Report Page Setup Form Code:
Private Sub Form_Load()
Dim option_AllReviewerReport As String
Dim option_AllVendorReport As String
option_AllReviewerReport = Me.OpenArgs
End Sub

Private Sub optLandscape_GotFocus()
If option_AllReviewerReport = Me.OpenArgs Then
DoCmd.Close acForm, "Report Page Setup", acSaveYes
DoCmd.OpenReport "Reviewer Report Landscape", acViewPreview
End If
End Sub

Private Sub optPortrait_GotFocus()
If option_AllReviewerReport = Me.OpenArgs Then
DoCmd.Close acForm, "Report Page Setup", acSaveYes
DoCmd.OpenReport "Reviewer Report", acViewPreview
End If
End Sub
Ken Sheridan said:
Ayo:

It sounds like you might have unchecked the 'show' box for all the columns
in design view. What you should have in query design view is one column with
the asterisk in its 'field' row and its 'show' box CHECKED, and [Vendor] and
[Market Reviewer] in the 'field' rows of two other columns each with their
'show' box UNCHECKED and the references to the combo boxes in their
'criteria' rows.

Also, as the report is based on the query you don't need the 'filter'
argument when opening it; the references to the combo boxes in the query
provide the filtering. The following will do:

DoCmd.OpenReport "Reviewer by Vendor", acViewPreview

Ken Sheridan
Stafford, England

:

Thanks a lot Ken. I believe I am getting close but not quite there yet. I did
as you instructed and then I placed this code in the button click event:

Private Sub cmdVendor_Reviewer_Report_Click()
DoCmd.OpenReport "Reviewer by Vendor", acViewPreview, "Reviewer by
Vendor"
End Sub

Now I am getting this error massage: Run-time error '3066', "Query must
have at least one destination field." I don't know what that means.

Ayo


:

In query design view add the [Invoice Tracker] table to the query, and then
add the asterisk to the first column of the design grid so it returns all
fields. Then add the [vendor] and [market reviewer] fields to the second and
third columns in the design grid and uncheck their 'show' checkboxes. In the
'criteria' row of the [vendor] column put Forms![Select Vendor and
Reviewer]![cmbVendorName] and in the 'criteria' row of the [market reviewer]
column put Forms![Select Vendor and Reviewer]![cmbMarketReviewer]. Save the
query under a suitable name.

Design the report (you can use the report wizard for this if you wish) and
use the name of query you created as its RecordSource property. If you use
the wizard you'll simply select the query from a list.

To open the report you could put a button on the [Select Vendor and
Reviewer] form. You can use the button wizard to generate the code in its
Click event if you wish, or you can write it yourself. When the button is
clicked the report will open filtered to the vendor and market reviewer
selected in the combo boxes. You might want two buttons in fact, one to
preview the report and one to print it.

BTW I notice that in my last reply I didn't enclose the name of the Market
Reviewer column in brackets in the SQL statement. As it contains a space it
needs these, so should have been [Market Reviewer]. When you design a query
in design view, however, Access will automatically put brackets around all
object names, so you don't have to remember to do this as you would if
writing the query in SQL view.

Ken Sheridan
Stafford, England

:

How do I go about "saving the query with the reference to the controls on the
form as parameters"

:

As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

:

I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
A

Ayo

Hi Ken,
It's me again. Sorry to bother you but, is the following a valid code?
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=(cmbMarketReviewer.Value,cmbVendorName.Value)

This is the whole code module:
Private Sub cmdVMR_Rep_Click()
Dim Msg, Style, Title, Response, strReviewer, strVendor

Msg = "You need not select a both Reviewer and Vendor. Click Yes to
continue." ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Selected Reviewer and Vendor" ' Define title.
strReviewer = Forms![Select Vendor and Reviewer].cmbMarketReviewer.Value
strVendor = Forms![Select Vendor and Reviewer].cmbVendorName.Value

If IsNull(strReviewer) Or IsNull(strVendor) Then
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
DoCmd.OpenForm "Select Vendor and Reviewer", acNormal, , , ,
acDialog ' Perform some action.
Else ' User chose No.
Exit Sub ' Perform some action.
End If
Else
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=cmbMarketReviewer.Value
DoCmd.Close acForm, "Select Vendor and Reviewer"
End If
End Sub

Ken Sheridan said:
As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first with
the table as its RecordSource, and assign the SQL string to its RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of the
constant literal string. You could, however, alternatively use a variable
rather than a constant and concatenate the values of the controls into the
string expression, making sure you wrap them in quotes characters if they are
text.

Ken Sheridan
Stafford, England

Ayo said:
I am looking to create a query in VBA code using values from ComboBoxes on a
form and use the resulting query to generate a report. So far I have the
following snippets of code but there is an error and I can't figure out what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND ((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
D

Douglas J. Steele

You can only pass a single value as the OpenArgs. You'll have to concatenate
the two values you're trying to pass into a single delimited one, then
separate the values back in the form being called.

DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:= cmbMarketReviewer.Value & "," & cmbVendorName.Value

If you're using a comma to delimit (as I did above), make sure commas will
never legitimately appear in either of the values.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ayo said:
Hi Ken,
It's me again. Sorry to bother you but, is the following a valid code?
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=(cmbMarketReviewer.Value,cmbVendorName.Value)

This is the whole code module:
Private Sub cmdVMR_Rep_Click()
Dim Msg, Style, Title, Response, strReviewer, strVendor

Msg = "You need not select a both Reviewer and Vendor. Click Yes to
continue." ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Selected Reviewer and Vendor" ' Define title.
strReviewer = Forms![Select Vendor and Reviewer].cmbMarketReviewer.Value
strVendor = Forms![Select Vendor and Reviewer].cmbVendorName.Value

If IsNull(strReviewer) Or IsNull(strVendor) Then
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
DoCmd.OpenForm "Select Vendor and Reviewer", acNormal, , , ,
acDialog ' Perform some action.
Else ' User chose No.
Exit Sub ' Perform some action.
End If
Else
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=cmbMarketReviewer.Value
DoCmd.Close acForm, "Select Vendor and Reviewer"
End If
End Sub

Ken Sheridan said:
As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first
with
the table as its RecordSource, and assign the SQL string to its
RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of
the
constant literal string. You could, however, alternatively use a
variable
rather than a constant and concatenate the values of the controls into
the
string expression, making sure you wrap them in quotes characters if they
are
text.

Ken Sheridan
Stafford, England

Ayo said:
I am looking to create a query in VBA code using values from ComboBoxes
on a
form and use the resulting query to generate a report. So far I have
the
following snippets of code but there is an error and I can't figure out
what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND
((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor
and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
A

Ayo

Thanks Douglas. That was very helpful. My problem now is I don't know how to
seperate the values. This is not working very well:
Me.txtReviewer1.Value = Me.OpenArgs
Me.txtVendor1.Value = Me.OpenArgs
I need to be able to seperate the OpenArgs values into something like this:
Me.txtReviewer1.Value = cmbMarketReviewer.Value
Me.txtVendor1.Value = cmbVendorName.Value
How is that accomplished?


Douglas J. Steele said:
You can only pass a single value as the OpenArgs. You'll have to concatenate
the two values you're trying to pass into a single delimited one, then
separate the values back in the form being called.

DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:= cmbMarketReviewer.Value & "," & cmbVendorName.Value

If you're using a comma to delimit (as I did above), make sure commas will
never legitimately appear in either of the values.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ayo said:
Hi Ken,
It's me again. Sorry to bother you but, is the following a valid code?
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=(cmbMarketReviewer.Value,cmbVendorName.Value)

This is the whole code module:
Private Sub cmdVMR_Rep_Click()
Dim Msg, Style, Title, Response, strReviewer, strVendor

Msg = "You need not select a both Reviewer and Vendor. Click Yes to
continue." ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Selected Reviewer and Vendor" ' Define title.
strReviewer = Forms![Select Vendor and Reviewer].cmbMarketReviewer.Value
strVendor = Forms![Select Vendor and Reviewer].cmbVendorName.Value

If IsNull(strReviewer) Or IsNull(strVendor) Then
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
DoCmd.OpenForm "Select Vendor and Reviewer", acNormal, , , ,
acDialog ' Perform some action.
Else ' User chose No.
Exit Sub ' Perform some action.
End If
Else
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=cmbMarketReviewer.Value
DoCmd.Close acForm, "Select Vendor and Reviewer"
End If
End Sub

Ken Sheridan said:
As the object of the exercise is to produce a report why do you need any
code? Why not just design and save the query with the reference to the
controls on the form as parameters, and design and save a report with the
query as its RecordSource?

If you really want to do it in code, you don't need to create a querydef
object, just design and save the report, called rptInvoice below, first
with
the table as its RecordSource, and assign the SQL string to its
RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part of
the
constant literal string. You could, however, alternatively use a
variable
rather than a constant and concatenate the values of the controls into
the
string expression, making sure you wrap them in quotes characters if they
are
text.

Ken Sheridan
Stafford, England

:

I am looking to create a query in VBA code using values from ComboBoxes
on a
form and use the resulting query to generate a report. So far I have
the
following snippets of code but there is an error and I can't figure out
what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" & ")AND
((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select Vendor
and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
D

Douglas J. Steele

OpenArgs is a single value: a string containing whatever was in
cmbMarketReviewer.Value, followed by a comma, followed by whatever was in
cmbVendorName.Value.

In the receiving form, you need code like:

Dim lngComma As Long

If IsNull(Me.OpenArgs) = False Then
lngComma = InStr(Me.OpenArgs, ",")
If lngComma = 0 Then
MsgBox "OpenArgs didn't contain two values"
Else
Me.txtReviewer1.Value = Left(Me.OpenArgs, lngComma - 1)
Me.txtVendor1.Value = Mid(Me.OpenArgs, lngComma + 1)
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ayo said:
Thanks Douglas. That was very helpful. My problem now is I don't know how
to
seperate the values. This is not working very well:
Me.txtReviewer1.Value = Me.OpenArgs
Me.txtVendor1.Value = Me.OpenArgs
I need to be able to seperate the OpenArgs values into something like
this:
Me.txtReviewer1.Value = cmbMarketReviewer.Value
Me.txtVendor1.Value = cmbVendorName.Value
How is that accomplished?


Douglas J. Steele said:
You can only pass a single value as the OpenArgs. You'll have to
concatenate
the two values you're trying to pass into a single delimited one, then
separate the values back in the form being called.

DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:= cmbMarketReviewer.Value & "," & cmbVendorName.Value

If you're using a comma to delimit (as I did above), make sure commas
will
never legitimately appear in either of the values.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ayo said:
Hi Ken,
It's me again. Sorry to bother you but, is the following a valid code?
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=(cmbMarketReviewer.Value,cmbVendorName.Value)

This is the whole code module:
Private Sub cmdVMR_Rep_Click()
Dim Msg, Style, Title, Response, strReviewer, strVendor

Msg = "You need not select a both Reviewer and Vendor. Click Yes to
continue." ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Selected Reviewer and Vendor" ' Define title.
strReviewer = Forms![Select Vendor and
Reviewer].cmbMarketReviewer.Value
strVendor = Forms![Select Vendor and Reviewer].cmbVendorName.Value

If IsNull(strReviewer) Or IsNull(strVendor) Then
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
DoCmd.OpenForm "Select Vendor and Reviewer", acNormal, , , ,
acDialog ' Perform some action.
Else ' User chose No.
Exit Sub ' Perform some action.
End If
Else
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=cmbMarketReviewer.Value
DoCmd.Close acForm, "Select Vendor and Reviewer"
End If
End Sub

:

As the object of the exercise is to produce a report why do you need
any
code? Why not just design and save the query with the reference to
the
controls on the form as parameters, and design and save a report with
the
query as its RecordSource?

If you really want to do it in code, you don't need to create a
querydef
object, just design and save the report, called rptInvoice below,
first
with
the table as its RecordSource, and assign the SQL string to its
RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part
of
the
constant literal string. You could, however, alternatively use a
variable
rather than a constant and concatenate the values of the controls into
the
string expression, making sure you wrap them in quotes characters if
they
are
text.

Ken Sheridan
Stafford, England

:

I am looking to create a query in VBA code using values from
ComboBoxes
on a
form and use the resulting query to generate a report. So far I have
the
following snippets of code but there is an error and I can't figure
out
what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" &
")AND
((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select
Vendor
and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
A

Ayo

Thank you so much. I would have never been able to figure that out, since my
coding isn't that sophisticated yet.

Ayo

Douglas J. Steele said:
OpenArgs is a single value: a string containing whatever was in
cmbMarketReviewer.Value, followed by a comma, followed by whatever was in
cmbVendorName.Value.

In the receiving form, you need code like:

Dim lngComma As Long

If IsNull(Me.OpenArgs) = False Then
lngComma = InStr(Me.OpenArgs, ",")
If lngComma = 0 Then
MsgBox "OpenArgs didn't contain two values"
Else
Me.txtReviewer1.Value = Left(Me.OpenArgs, lngComma - 1)
Me.txtVendor1.Value = Mid(Me.OpenArgs, lngComma + 1)
End If
End If

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ayo said:
Thanks Douglas. That was very helpful. My problem now is I don't know how
to
seperate the values. This is not working very well:
Me.txtReviewer1.Value = Me.OpenArgs
Me.txtVendor1.Value = Me.OpenArgs
I need to be able to seperate the OpenArgs values into something like
this:
Me.txtReviewer1.Value = cmbMarketReviewer.Value
Me.txtVendor1.Value = cmbVendorName.Value
How is that accomplished?


Douglas J. Steele said:
You can only pass a single value as the OpenArgs. You'll have to
concatenate
the two values you're trying to pass into a single delimited one, then
separate the values back in the form being called.

DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:= cmbMarketReviewer.Value & "," & cmbVendorName.Value

If you're using a comma to delimit (as I did above), make sure commas
will
never legitimately appear in either of the values.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hi Ken,
It's me again. Sorry to bother you but, is the following a valid code?
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=(cmbMarketReviewer.Value,cmbVendorName.Value)

This is the whole code module:
Private Sub cmdVMR_Rep_Click()
Dim Msg, Style, Title, Response, strReviewer, strVendor

Msg = "You need not select a both Reviewer and Vendor. Click Yes to
continue." ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Selected Reviewer and Vendor" ' Define title.
strReviewer = Forms![Select Vendor and
Reviewer].cmbMarketReviewer.Value
strVendor = Forms![Select Vendor and Reviewer].cmbVendorName.Value

If IsNull(strReviewer) Or IsNull(strVendor) Then
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
DoCmd.OpenForm "Select Vendor and Reviewer", acNormal, , , ,
acDialog ' Perform some action.
Else ' User chose No.
Exit Sub ' Perform some action.
End If
Else
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=cmbMarketReviewer.Value
DoCmd.Close acForm, "Select Vendor and Reviewer"
End If
End Sub

:

As the object of the exercise is to produce a report why do you need
any
code? Why not just design and save the query with the reference to
the
controls on the form as parameters, and design and save a report with
the
query as its RecordSource?

If you really want to do it in code, you don't need to create a
querydef
object, just design and save the report, called rptInvoice below,
first
with
the table as its RecordSource, and assign the SQL string to its
RecordSource
property transparently, and then open the report, e.g.

On Error GoTo Err_Handler

Const conSQL = SELECT * FROM [Invoice Tracker] " & _
"WHERE Vendor = " & _
"Forms![Select Vendor and Reviewer]![cmbVendorName] " & _
"AND Market Reviewer = " & _
"Forms![Select Vendor and Reviewer]![cmbMarketReviewer]"

Application.Echo False
DoCmd.OpenReport "rptInvoice", acViewDesign
Reports("rptInvoice").RecordSource = conSQL
DoCmd.Close acReport, "rptInvoice", acSaveYes
Application.Echo True

DoCmd.OpenReport "rptInvoice", acViewPreview

Exit_Here:
Exit Sub

Err_Handler:
Application.Echo True
MsgBox Err.Description
Resume Exit_Here

The above includes the references to the controls on the form as part
of
the
constant literal string. You could, however, alternatively use a
variable
rather than a constant and concatenate the values of the controls into
the
string expression, making sure you wrap them in quotes characters if
they
are
text.

Ken Sheridan
Stafford, England

:

I am looking to create a query in VBA code using values from
ComboBoxes
on a
form and use the resulting query to generate a report. So far I have
the
following snippets of code but there is an error and I can't figure
out
what
I am doing wrong. Can any one help?

Private Sub cmdVendor_Reviewer_Report_Click()
Dim dbs As Database: Dim qdf As QueryDef: Dim strSQL As String

Set dbs = CurrentDb
strSQL = "SELECT * FROM [Invoice Tracker] WHERE ((([Invoice
Tracker].Vendor)=" & _
"Forms![Select Vendor and Reviewer]![cmbVendorName]" &
")AND
((" & _
"([Invoice Tracker].Market Reviewer)=" & "Forms![Select
Vendor
and
Reviewer]![cmbMarketReviewer]" & "));"
Set qdf = dbs.CreateQueryDef("SecondQuarter", strSQL)
'DoCmd.OpenQuery "SecondQuarter", , acReadOnly
DoCmd.OpenQuery qdf, , acReadOnly
End Sub

Thanks
 
K

Ken Sheridan

Ayo:

The line:

DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , , acDialog,
OpenArgs:=(cmbMarketReviewer.Value,cmbVendorName.Value)

is not valid as you cannot pass two separate values directly via the
OpenArgs mechanism. It is possible to do so, however, by making use of a
module which was developed by my former colleague Stuart McCall and myself
which allows value lists (of literal values only, so not applicable in your
case) or a list of named arguments (which could be used in your case).
You'll find a file which demonstrates the use of the module at:


http://community.netscape.com/n/pfx...yMessages&tsn=1&tid=24091&webtag=ws-msdevapps


As far as the code for the whole procedure is concerned I'd make a few points:

1. Its best to declare the variables as the relevant types even though the
code will work without doing so. Leaving them untyped as you've done makes
them all of type Variant. Msg, Title, strReviewer and strVendor would be
declared As String (See my further comments below with regard to the
strReviewer and strVendor, however); Style and Response would be declared As
Integer. Note that if you declare multiple variables in one line each should
be individually given a type, even if all are of the same type.

2. The 'If IsNull(strReviewer) Or IsNull(strVendor) Then' line means that
the message box will only pop up if one or both of the controls is left Null.
To my mind the message "You need not select a both Reviewer and Vendor.
Click Yes to continue." sounds more as though both controls have been used
and you are alerting the user to the fact that its not actually necessary to
use both. My approach would have been to make this clear by means of a label
on the form, in which case there would be no need to do so in the code.

However, strReviewer and strVendor are, to judge by the 'str' tags, clearly
meant to be of String data type. Only a variable of Variant data type can be
Null, however, so if you do keep to your current approach of using the code
to inform the user of the optional nature of each control, these should be
declared as such, e.g.

Dim varReviewer As Variant, varVendor As Variant

and then you'd use:

If IsNull(varReviewer) Or IsNull(varVendor) Then

3. The following lines:

Else ' User chose No.
Exit Sub ' Perform some action.

are unnecessary as if the user responds with 'No' the code execution will
immediately pass to the End Sub line.

If there are any new points, rather than developments of this thread, which
you need to raise please do so in new threads. This will give more
opportunity for others to chip in.

Ken Sheridan
Stafford, England

Ayo said:
Hi Ken,
It's me again. Sorry to bother you but, is the following a valid code?
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=(cmbMarketReviewer.Value,cmbVendorName.Value)

This is the whole code module:
Private Sub cmdVMR_Rep_Click()
Dim Msg, Style, Title, Response, strReviewer, strVendor

Msg = "You need not select a both Reviewer and Vendor. Click Yes to
continue." ' Define message.
Style = vbYesNo + vbCritical + vbDefaultButton2 ' Define buttons.
Title = "Selected Reviewer and Vendor" ' Define title.
strReviewer = Forms![Select Vendor and Reviewer].cmbMarketReviewer.Value
strVendor = Forms![Select Vendor and Reviewer].cmbVendorName.Value

If IsNull(strReviewer) Or IsNull(strVendor) Then
Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
DoCmd.OpenForm "Select Vendor and Reviewer", acNormal, , , ,
acDialog ' Perform some action.
Else ' User chose No.
Exit Sub ' Perform some action.
End If
Else
DoCmd.OpenForm "Invoice by Reviewer and Vendor", acNormal, , , ,
acDialog, OpenArgs:=cmbMarketReviewer.Value
DoCmd.Close acForm, "Select Vendor and Reviewer"
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top