Hi
I'm going round in circles and, as a pretty amateur Access bod, wondered if anyone might be able to point me in the right direction with this, I'll try to describe the issue as best I can! :
My users complete a form called claims to create a new claim. Each new claim gets a unique auto number (claim number). I want the user to be able to click a button on the form that exports the output of a query based on the claim number on the form, so they just export to XML the claim they have just created.
I have created the query and used the criteria [Forms]![Claims]![Claim number] in the Claim number field of the query (the query uses data from linked tables to populate results). To test I created a command button on the form to run the query and this works perfectly. But, this just opens the query result so I now want to create a command button that rather than showing the query result, just exports the result as xml to a network folder.
My problem is that I do not know how to edit the VBA in a Application.ExportXML to make the query use the claim number on the form, I'm guessing that I need to add a command to set the paramaters to be used but am clueless on how to achieve this!
The code I've been playing with is this below, which when run, pops up a box asking for the claim number (assuming that this means the query does not know which claim number I want to use), once the claim number is inputted it runs fine but I want it to know the claim number without asking as I don't want the users having to input it manually as that introduces opportunity for human error....hope that makes sense:
Private Sub Command306_Click()
On Error GoTo Err_Command306_Click
Application.ExportXML ObjectType:=acExportQuery, DataSource:="Repairtech Job order_NEW TEST", _
Datatarget:="\\10.1.0.5\data\Repairtech\Data Transfers\EISL Jobs to RT\EISL AGA Job order" & Format(Now, "_dmmmyy_hhnnss") & ".xml"
Exit_Command306_Click:
Exit Sub
Err_Command306_Click:
MsgBox Err.Description
Resume Exit_Command306_Click
End Sub
Any help anyone could give would be much appreciated, thanks.
I'm going round in circles and, as a pretty amateur Access bod, wondered if anyone might be able to point me in the right direction with this, I'll try to describe the issue as best I can! :
My users complete a form called claims to create a new claim. Each new claim gets a unique auto number (claim number). I want the user to be able to click a button on the form that exports the output of a query based on the claim number on the form, so they just export to XML the claim they have just created.
I have created the query and used the criteria [Forms]![Claims]![Claim number] in the Claim number field of the query (the query uses data from linked tables to populate results). To test I created a command button on the form to run the query and this works perfectly. But, this just opens the query result so I now want to create a command button that rather than showing the query result, just exports the result as xml to a network folder.
My problem is that I do not know how to edit the VBA in a Application.ExportXML to make the query use the claim number on the form, I'm guessing that I need to add a command to set the paramaters to be used but am clueless on how to achieve this!
The code I've been playing with is this below, which when run, pops up a box asking for the claim number (assuming that this means the query does not know which claim number I want to use), once the claim number is inputted it runs fine but I want it to know the claim number without asking as I don't want the users having to input it manually as that introduces opportunity for human error....hope that makes sense:
Private Sub Command306_Click()
On Error GoTo Err_Command306_Click
Application.ExportXML ObjectType:=acExportQuery, DataSource:="Repairtech Job order_NEW TEST", _
Datatarget:="\\10.1.0.5\data\Repairtech\Data Transfers\EISL Jobs to RT\EISL AGA Job order" & Format(Now, "_dmmmyy_hhnnss") & ".xml"
Exit_Command306_Click:
Exit Sub
Err_Command306_Click:
MsgBox Err.Description
Resume Exit_Command306_Click
End Sub
Any help anyone could give would be much appreciated, thanks.