Naming files in VB produced through Access Queries

  • Thread starter Thread starter Sally
  • Start date Start date
S

Sally

On the database I am creating, I have a report that will
be produced and then saved as a csv file.

I daclared the file name as such:

Dim fname As String

and I wanted the name of the reoprt to be entered via a
text box on a form that conatins the button for setting
of the queries, so the user would enter the name of what
they would like the report to be called, although my code
is wrong and I can't think of how it should be. Does
Anytone know? my code is the following:

fname = "C:\" & [options]!txtname & ".csv"
 
You must refer explicitly to the Forms collection, either
by:

fname = "C:\" & Forms![options]!txtname & ".csv"

or, more compactly, by using Access defaults,

fname = "C:\" & Me!txtname & ".csv"

HTH

Best regards,

Kevin Sprinkel
Becker & Frondorf
-----Original Message-----
On the database I am creating, I have a report that will
be produced and then saved as a csv file.

I daclared the file name as such:

Dim fname As Stringfname = "C:\" & [options]!txtname & ".csv"
.
 
Hi Sally,

There's code at http://mvps.org/access/api/api0001.html that displays
the standard Save As dialog so you can collect the name in the way users
are accustomed to.

On the database I am creating, I have a report that will
be produced and then saved as a csv file.

I daclared the file name as such:

Dim fname As String

and I wanted the name of the reoprt to be entered via a
text box on a form that conatins the button for setting
of the queries, so the user would enter the name of what
they would like the report to be called, although my code
is wrong and I can't think of how it should be. Does
Anytone know? my code is the following:

fname = "C:\" & [options]!txtname & ".csv"
 
Back
Top