| View previous topic :: View next topic |
| Author |
Message |
Maraujo Newbie

Joined: 07 May 2009 Posts: 3 Location: Portugal
|
Posted: Thu May 07, 2009 12:45 am Post subject: Filter Combobox content from DataField? |
|
|
Hello All!
I am trying to sort this problem out since a few days now and i seem to have reached a dead end:
I have simple form with:
-Combo Box
-Date Field
What i need is a macro to filter the combobox content based on the day of the Date Field.
I have query thatrrtrieving the right results (tested it on postgresql) :
SQLQuery= "SELECT ""StringTable"".""Val"" FROM ""StringTable"",""TagTable"" WHERE (""StringTable"".""DateAndTime"" LIKE '"+Date+"%') AND ""StringTable"".""TagIndex""=""TagTable"".""TagIndex"" AND ""TagTable"".""TagIndex""=8 ORDER BY ""Val"" ASC"
The main question is:
How do i fill in the combobox with the results from the query?This is the same as saying: how do i assign combobox content in a macro?
Suggestion will be much appreciated!
Cheers,
Mark |
|
| Back to top |
|
 |
Maraujo Newbie

Joined: 07 May 2009 Posts: 3 Location: Portugal
|
Posted: Thu May 07, 2009 5:05 am Post subject: |
|
|
Just cracked the sucker (after a week... )
If someone else has the same problem:
I used this:
SQLQuery2= "SELECT ""StringTable"".""Val"" FROM ""StringTable"",""TagTable"" WHERE (""StringTable"".""DateAndTime"" LIKE '"+OPDate+"%') AND ""StringTable"".""TagIndex""=""TagTable"".""TagIndex"" AND ""TagTable"".""TagIndex""=8 ORDER BY ""Val"" ASC"
SQLStatement=ConnectToDatabase.createStatement
RowSetObj2=SQLStatement.executeQuery (SQLQuery2)
j=0
While RowSetObj2.Next
oText = RowSetObj2.getstring(1) Rem---updates combobox to value in the first column of the queried table
ArrayofStrings(j)= oText Rem--Saves to the array
' MsgBox ("element is " & ArrayofStrings(j)) Rem--Debug to see the content of the array
j=j+1
Wend
oTestComboBox.stringItemList()= ArrayofStrings()
oTestComboBox.text=ArrayofStrings(0)
End Sub
The stringItemList() worked just fine! |
|
| Back to top |
|
 |
|