Options Buttons, not Radio Buttons

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

I have a form containing three option buttons and one
additional button. The addiontal button is tied to VBA
code which imports some text files into a table. I have
three different import speficiations and I would like to
tie each specification into one of the three option
buttons.

The below code is for the importation command:

DoCmd.TransferText acImportDelim, myspec, tablename,
strFolder & myfile

The 'myspec' variable is for the different specification
types. What I want to be able to do is have 3 option
buttons, for 'specification1', 'specification2',
and 'specification3'. So when option button one is
clicked, it sends specification1 into the 'myspec'
variable, and then imports the text file according to that
particular specification.

Thank You
 
Bob, use an option group instead and run code on the click of your button to
check which option is selected and set the variable accordingly like so (air
code)


Private Sub cmdImport_Click()

Dim mySpec as String
Select Case Me.myOptionGroup
Case 1
mySpec = "specification1"
Case 2
mySpec = "specification2"
Case 3
mySpec = "specification3"
End Select

DoCmd.TransferText acImportDelim, mySpec, tablename, strFolder & myfile

End Sub
 
Back
Top