Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am working with a macro in one of my QVWs. I am receiving the following error on this IF statement.
sub SelectSDStore
if ActiveDocument.Fields("OPCO") = ("Store A") then
ActiveDocument.Fields("Store_Info").Select "12-Store 12",1
end if
End Sub
ERROR: Object doesn't support this property or method
I am trying to get the value of one multi select box and if it equals that value, I want to default the selection of the store number. Is there a better route of doing this?
Thanks for any information
So here is the code that will work............
SUB SeeValues
SET s = ActiveDocument.Fields("field1").GetSelectedValues
For x = 0 to s.Count - 1
IF s.Item(x).Text = "C" THEN ActiveDocument.Fields("field2").Select "C1"
Next
END SUB
Obviously change field1 and field2 for your names, and then change the comparison and select text.
You're IF statement should be:
IF ActiveDocument.Fields("OPCO").GetContent.String = 'Store A' THEN ..................
That should do the trick for you.
Scrub that, I'm wrong, I've just given you the code for a variable rather than a field.
When you say that the field is in a multi select box, does that mean that you might have multiple values selected and in this case you want to know if Store A is one of those values selected?
Thanks,
So here is the code that will work............
SUB SeeValues
SET s = ActiveDocument.Fields("field1").GetSelectedValues
For x = 0 to s.Count - 1
IF s.Item(x).Text = "C" THEN ActiveDocument.Fields("field2").Select "C1"
Next
END SUB
Obviously change field1 and field2 for your names, and then change the comparison and select text.
Thanks! This worked perfectly.
What is the syntax to default an option to have multiple selections for Field2? I think I have tried everything so far and this is what I have come up with.
IF s.Item(x).Text = "OPCO" THEN ActiveDocument.Fields("GMM_Info").Select "C1" and "C2"
Any help is greatly appreciated.