OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Filter Combobox content from DataField?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
Maraujo
Newbie
Newbie


Joined: 07 May 2009
Posts: 3
Location: Portugal

PostPosted: Thu May 07, 2009 12:45 am    Post subject: Filter Combobox content from DataField? Reply with quote

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! Smile
Cheers,
Mark
Back to top
View user's profile Send private message
Maraujo
Newbie
Newbie


Joined: 07 May 2009
Posts: 3
Location: Portugal

PostPosted: Thu May 07, 2009 5:05 am    Post subject: Reply with quote

Just cracked the sucker Very Happy (after a week...Confused )

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group