Want to code a command button

  • Thread starter Thread starter dab1477
  • Start date Start date
D

dab1477

I've also posted in VBA Coding.
I attempted to assign the TransferSpreadsheet command to a
button, such that a person could click the button and have the resulting
query transferred to a spreadsheet. I used the following code:

Private Sub Command3_Click()
Select Case fraExportType
Case 1
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
"weekly ftq by machine center", "e:\dave\caledonia\Rockford
2008\FTQTest.xls", True
End Select
End Sub

When I click my command button, I don't get anything. Is there something
different that I should do? I have been unsuccessful in my attempts for the
last few days. Any direction would be appreciated. Thank you.
 
I've also posted in VBA Coding.
I attempted to assign the TransferSpreadsheet command to a
button, such that a person could click the button and have the resulting
query transferred to a spreadsheet. I used the following code:

Private Sub Command3_Click()
Select Case fraExportType
Case 1
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97,
"weekly ftq by machine center", "e:\dave\caledonia\Rockford
2008\FTQTest.xls", True
End Select
End Sub

When I click my command button, I don't get anything. Is there something
different that I should do? I have been unsuccessful in my attempts for the
last few days. Any direction would be appreciated. Thank you.

Why a Select Case with just one Case?
Perhaps the value of fraExportType is not 1.

Did you place a break point in the code and step through it?
 
How do I change fraExportType to a value of 2? Obviously I'm new to coding.
Thanks for the direction.
 
How do I change fraExportType to a value of 2? Obviously I'm new to coding.
Thanks for the direction.

Well, did you set a breakpoint and step through the code?

i think you have to back up a bit. What type of control is
frExportType? Is a an Option group? If so, you add buttons to the
group. Each button has a different number value starting from 1. If
you click a button, the value of the Option Group is taken from the
value of the button pressed.

Anyway, I would suggest you rethink your question and re-write it so
that someone who can't see your database will know what it is you are
trying to accomplish.
 
Back
Top