PDA

View Full Version : Opening a form with a variable value from a table


ABC123

rmcgaffic
04-26-2008, 01:16 PM
I have created a new form with only one A5V9 pushbutton control, which executes the code below:


tbl = table.open("tblMenu")
tbl.fetch_first()
tbl = table.open("tblMenu")
tbl.fetch_first()

Dim mSelectedForm As C
mSelectedForm = tbl.FORM_ID
msgbox(mSelectedForm)
'msgbox displays: frmA

f=form.load(mSelectedForm)
f.show()
f.activate()
When a button on a A5V9 form with no other controls, which invokes this code is clicked, the following message is received:

"Object does not support requested interface"

Importantly this issue

Dim mSelectedForm As C
mSelectedForm = tbl.FORM_ID
msgbox(mSelectedForm)
'msgbox displays: frmA

f=form.load(mSelectedForm)
f.show()
f.activate()[/CODE]

I earlier reported success in creating an hierarchical menu using a third party Tree control. I have worked through all the control issues, but just as I was ready to post my code to the code library, I hit what hopefully is not a fatal bump.

To demonstrate this issue,

Steve Workings
04-26-2008, 01:21 PM
Almost. The alltrim() is your key here.


tbl = table.open("tblMenu")
tbl.fetch_first()
tbl = table.open("tblMenu")
tbl.fetch_first()

Dim mSelectedForm As C
mSelectedForm = alltrim(tbl.FORM_ID)
msgbox(mSelectedForm)
'msgbox displays: frmA

f = form.view(mSelectedForm)

rmcgaffic
04-26-2008, 01:48 PM
Mr. Moderator,

I aplogize for this incomplete post. I hit Submit before I was through

rmcgaffic
04-26-2008, 07:16 PM
All,

Everything now appears to be working correctly. I have documented this project in a 16 page MS word document, including all code and screen prints of control settings, available in the Code Archive with the title "How to create a dynamic hierarchical menu"

Bob McGaffic
Pittsburgh