Link between query and form lost.

nkamp

Registered User.
Local time
Today, 13:18
Joined
Mar 2, 2007
Messages
15
Hallo,

I'm quit new to Access.
I have an existing application. There is a form with some selection fields. When I press the button report then following is executed:
- The report object is called with DoCmd.OpenReport Rpt, acPreview
- This report has object dependencies with the query qryRptClient AND the form frmClient. This is the form with the selectia criteria.

The query "qryRptClient" has nested query's but in some of them, in the where clause fields are tested like: "WHERE (tblTempProject.country=forms!frmClientReq!cmbCountry"

Generating of the report works correct ==> so far so good.!

Now the application must be extended by exporting this report result to XML file. So I have added on the form another button wich is calling the same query Like:
Code:
  Application.ExportXML _ 
    ObjectType:=acExportQuery, _ 
    DataSource:="qryRptClient", _ 
    DataTarget:="c:\Projecten\test\exports\" & FileName

But now I get for every selection criteria field which is used in the query's a popup window asking what the value is of this form object.

So, I understand with the report that there is a link between the report, query and the form but in the second occassion how do I get a link between the query and the form.

Can somebody help me? Thanks in advance.

Nico.

P.s. When I try this with northwind database, with the query invoices, it working correct and I get a XML file! So the export on itself is working.
 
usaualy you use the EVAL function

here is an example
Dim db As Database
Dim qdf As QueryDef
Dim prm As Parameter
Dim rst As Recordset

Set db = CurrentDb
Set qdf = db.QueryDefs("OverseenBy")

' Simulate the expression service
' to provide the values from the open form
For Each prm In qdf.Parameters
prm.Value = Eval(prm.Name)
Next

Set rst = qdf.OpenRecordset(dbOpenDynaset)
 

Users who are viewing this thread

Back
Top Bottom