Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Problem in macro

Hi,

Im using a macro to set 'Always one selected' Property for a listbox.

For eg: 'Currency' Field

In one Tab, 'Currency' Field should have default selection as 'Euro' and the same field should be cleared in another sheet (No value selected).

It was working in my development environment , But not in the accesspoint. Please let me clear what may be the problem

Im using the following macro:

Sub Select
ActiveDocument.Fields("Currency").Select "EURO"
set fld1 = ActiveDocument.GetField("Currency")
set fprop1 = fld1.GetProperties
fprop1.OneAndOnlyOne = true
fld1.SetProperties fprop1
End Sub

Sub Clear
set fld = ActiveDocument.GetField("Currency")
set fprop = fld.GetProperties
fprop.OneAndOnlyOne = False
fld.SetProperties fprop
ActiveDocument.ClearAll
End Sub

First macro in one sheet , for the default selection and second one for clearing the macro

It was not working in the accesspoint

Can anyone help me in this? where Im doing wrong...

Thanks in advance,

Dhoulath

11 Replies
ipauldur
Creator
Creator

Hi,

I am facing the same issue. Did u get solution for this?.

Please share with me.

Thanks,

Durai.

Not applicable
Author

Have you enabled macros while it was asking you to enable it first time.

Whenever there is macros in file, at client it asks to enable macros. Enable all macros.

Hope it will help you.

qliksus
Specialist II
Specialist II

If u read the Limitaion of Using macro in Server it is mentioned that the macro will not work when u call it on

activation of sheet

ipauldur
Creator
Creator

Hi,

I enabled macros. Actually, its working fine on Qv9 version. Recently we have upgraded to Qv10Sr3 version. After that only, its not supporting. Even if you trigger the macro through button also not working. In the same application all macros are working fine when we open in desktop version. The issue is happening when we access the app from server. Especially the "AlwaysOneSelected Value" is not happening.

Thanks,

Durai.

Not applicable
Author

Seems to be a problem in QV10 SR3. We have the same system environment and OneAndOnlyOne = true is not working - even if i put it on a button.

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   If you look at the API it is been stated that whenever you use the "OneAndOnlyOne" property, that must be used with ShowAlternative property.

   Here is the sample code.

set fld=ActiveDocument.GetField("Class")

if fld.GetValueCount(1) = 1 then

    set fprop = fld.GetProperties

    fprop.ShowAlternatives = false

    fprop.OneAndOnlyOne = true

    fld.SetProperties fprop

end if

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Hi Kaushik,

thanks for your answer. I tried to work with your idea, but the macro still is not working. The only difference between using ShowAlternative or not is, that all not selected values are marked yellow. But you still can markup more than one value or markup no value (even if OneandOnly is set to true).

Regards, Martin

Not applicable
Author

Is there a solution for this bug in QV10 SR4 or in QV11?

Not applicable
Author

I have the same problem. It works fine in the desktop environtment, but it doesn't work in the accesspoint.

What I have discovered is that when you save the document from the desktop be sure that the "oneandonlyone" property is set to false. If you set the "oneandonlyone" property to true and you save the document, then you are not able to change the property with a macro in the accesspoint.