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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

correct syntax with automation

Status
Not open for further replies.

BusMgr

IS-IT--Management
Aug 21, 2001
138
US
I have an access form that I am using to generate a Word document.

On the form, I have a pseudo option group (because I want the user to be able to select more than one radio button)

The radio buttons are named opt1, opt2, opt3 etc., and the Access form is named frmMain.

In my code, I want to loop through the option buttons and and a row to the table on the Word doc if the option button is selected.

My code is as follows

dim strOpt as string

For i = 1 to 10
strOpt = "frmMain.opt" & i
If strOpt.value = -1 then
With .rows.add
.cell(1).range.text = "H"
.cell(2).range.text = "Special Radiused Insert"
end with
end if
next i

The problem is with the strOpt.value line. The syntax is not correct.

Thanks for your help in advance.
BusMgr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top