Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Edit a Macro

Status
Not open for further replies.

jahlmer

Technical User
Aug 23, 2000
143
US
I need to edit a macro based on a value on my form.

Here's an example:

macro1
action transferspreadsheet
c:\my\file.xls

I have a form with a value for c:\my\file2.xls

I want to click a button, and have the button use the value in the field to modify the macro.

I know you have the answer! Please help!
 
I'll be honest, I've never tried to do that in a macro before. If it's gonna work it will look like this:

"C:\my\" & TextBoxNameHere

If that doesn't work I would use code behind the button that looked like this:

DoCmd.TransferSpreadsheet , acSpreadsheetTypeExcel97, "InsertTableName", "C:\my\" & InsertTextBoxName

I'm using Access 97 so "acSpreadsheetTypeExcel97" is as late as mine will go, if you right click that part though, you can select "List Constants" and that will get you a list of your options.

Replace the stuff in Italics with your table name and text box name.

Hope this helps,
If you need help adding the code to the button, let me know.

Kyle ::)
 
Thanks Kyle,

That sounds very logical. I am also using Access 97. I'll try it out and post the results.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top