Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Experts,
Simply question for you all 🙂
I am trying to make a"from-till"selection on a database field.
For example: I want all product with [ProductID] from 20000 until 30000.
What I did sofar:
I made 2 variable: vProductID_first and vProductID_Max and made 2 inputboxes to fill in the numbers.
But how do i get vProductID_first to be the first of the range and vProductID_Max to be the last [ProductID].
I have been trying to make a button with a macro function to this but I don't seem to find the right macro code
Or is there an other way maybe?
Hi,
If you are looking for a macro you can use this:-
sub selection
ActiveDocument.ClearAll false
First= ActiveDocument.Variables("vProductID_first").GetContent.String
Last= ActiveDocument.Variables("vProductID_Max").GetContent.String
mySelect= ">" & First & " <" & Last
ActiveDocument.Fields("ProductID").Select mySelect
end sub
Thanks & Best Regards,
Kuldeep Tak
Do you want to apply your filter during the reload or done by the user ?
Rgds,
Sébastien
Hi, I find the way for your problem, but is don't still 100%
I use the trigger in button -> ToggleSelection.
The function Clear All in the trigger is not work. When the selection is clear manually the filter is OK.
Thanks Eduardo.
That is what I am looking for.
I have no idea why the "Clear" is not working, I am going to work on that.
Hi,
If you are looking for a macro you can use this:-
sub selection
ActiveDocument.ClearAll false
First= ActiveDocument.Variables("vProductID_first").GetContent.String
Last= ActiveDocument.Variables("vProductID_Max").GetContent.String
mySelect= ">" & First & " <" & Last
ActiveDocument.Fields("ProductID").Select mySelect
end sub
Thanks & Best Regards,
Kuldeep Tak
Thanks mister Kuldeep Tak!,
That is exacly what I need!
One more thing....
This works perfect with number, but how do I need to change this with names?
If I use this on alphabetic field with it doesn't work
Or even mixed numbers and letters ...
Anybody?
If you are searching text, enclose the search values in single quotes:
mySelect= ">'" & First & "' <'" & Last & "'"
Also, if you are uisng V9, I recommend you use the Action "select in field" instead of a macro.
-Rob