| View previous topic :: View next topic |
| Author |
Message |
AConnection General User


Joined: 08 Oct 2003 Posts: 5
|
Posted: Fri Mar 19, 2004 1:20 pm Post subject: Check content of ComboBox against Query populating it |
|
|
| Thanks for looking at this. I am trying now to take data entered into a combo box field in a form and check it against the query (or a query) that populates the box. It is very simple to generate a query to populate the box, and I can create a macro to check the content of the field, but how do I get both together? This would be a macro applied upon exiting the field, to emulate Access' ability to restrict the input of a field to the selection list. Thanks. |
|
| Back to top |
|
 |
dfrench Moderator

Joined: 03 Mar 2003 Posts: 1605 Location: Wellington, New Zealand
|
Posted: Fri Mar 19, 2004 2:04 pm Post subject: |
|
|
The control combobox has two properties: stringitemlist contains your valid items and text contains the entry (typed or selected from the list). The following code tests whether text is found within stringitemlist.
| Code: | Sub Main
'get the combo box control by name
octl= thiscomponent.drawpage.forms.getbyname("Standard").getbyname("ComboBox")
inlist=false
i=0
do while i<=ubound(octl.stringitemlist)
if octl.text= octl.stringitemlist(i) then
inlist=true
exit do
end if
i=i+1 ' increment through stringitemlist
loop
if not inlist then
msgbox "Entry not in valid list"
end if
End Sub |
|
|
| Back to top |
|
 |
|