Transfertext MAcro

  • Thread starter Thread starter Andrew C
  • Start date Start date
A

Andrew C

I have a transfer text macro that works fine and exports all records from my
query.

What i want to do is to add in a condition where a text box (renewdate) on
my main form equals the renewed date in my query. The macro is going to be
activated by a command button.

Below are the locations of the date field and location of the field


[1Financial Members]![Date Renewed]

[Main]![RenewDate]

So ultimately on my main form there will be a button called export that i
want to export members that have renewed based on the date entered in the
textbox called Renewdate.

Can someone tell me if thisis possible and how i can achieve this. i have
not done much with macros in a database.
 
A macro's TransferText action cannot export a parameter query (which you
would have if the query had the form's textbox as a criterion value in the
query's WHERE clause). And a TransferText action cannot concatenate a SQL
statement (including the filtering value) and use that as the exported
query.

You can do this in VBA code, where you use code to save a query with the
correct paramter value in the query, and then run the DoCmd.TransferText
action. Do you want to use VBA code?
 
Hi Ken

If it needs to be done by VBA code then i will use it. I only know the
basics of VBA Code. So the more info you can give me the better.

Can the information be pulled from the table instead of the query?

Table Name = MembersTable
Field NAme = Date Renewed

I assume that i use the VBA code with the On Click event procedure for the
button i have on the form.

Thanks

Andrew C

Ken Snell (MVP) said:
A macro's TransferText action cannot export a parameter query (which you
would have if the query had the form's textbox as a criterion value in the
query's WHERE clause). And a TransferText action cannot concatenate a SQL
statement (including the filtering value) and use that as the exported
query.

You can do this in VBA code, where you use code to save a query with the
correct paramter value in the query, and then run the DoCmd.TransferText
action. Do you want to use VBA code?

--

Ken Snell
<MS ACCESS MVP>


Andrew C said:
I have a transfer text macro that works fine and exports all records from
my
query.

What i want to do is to add in a condition where a text box (renewdate) on
my main form equals the renewed date in my query. The macro is going to
be
activated by a command button.

Below are the locations of the date field and location of the field


[1Financial Members]![Date Renewed]

[Main]![RenewDate]

So ultimately on my main form there will be a button called export that i
want to export members that have renewed based on the date entered in the
textbox called Renewdate.

Can someone tell me if thisis possible and how i can achieve this. i have
not done much with macros in a database.
 
I must apologize. I just tested using a macro's TransferText action with a
query that uses a value from a form's textbox as the WHERE criterion, and it
does work. Guess I remembered quite incorrectly!

So, to do what you want, open in design view the query that you're
exporting. Under the field "[1Financial Members]![Date Renewed]", put this
expression in the Where box:

Forms![Main]![RenewDate]

Save the query and close it. Now the TransferText action will use the value
of the RenewDate control on the form Main to filter the query when it's
exported.

--

Ken Snell
<MS ACCESS MVP>



Andrew C said:
Hi Ken

If it needs to be done by VBA code then i will use it. I only know the
basics of VBA Code. So the more info you can give me the better.

Can the information be pulled from the table instead of the query?

Table Name = MembersTable
Field NAme = Date Renewed

I assume that i use the VBA code with the On Click event procedure for the
button i have on the form.

Thanks

Andrew C

Ken Snell (MVP) said:
A macro's TransferText action cannot export a parameter query (which you
would have if the query had the form's textbox as a criterion value in
the
query's WHERE clause). And a TransferText action cannot concatenate a SQL
statement (including the filtering value) and use that as the exported
query.

You can do this in VBA code, where you use code to save a query with the
correct paramter value in the query, and then run the DoCmd.TransferText
action. Do you want to use VBA code?

--

Ken Snell
<MS ACCESS MVP>


Andrew C said:
I have a transfer text macro that works fine and exports all records
from
my
query.

What i want to do is to add in a condition where a text box (renewdate)
on
my main form equals the renewed date in my query. The macro is going
to
be
activated by a command button.

Below are the locations of the date field and location of the field


[1Financial Members]![Date Renewed]

[Main]![RenewDate]

So ultimately on my main form there will be a button called export that
i
want to export members that have renewed based on the date entered in
the
textbox called Renewdate.

Can someone tell me if thisis possible and how i can achieve this. i
have
not done much with macros in a database.
 
Back
Top