Walter A. March wrote:
Andrew Jensen wrote:
By the way the other option is to change the code to this
sub onSearchDate( oEv )
dim dtSearch
dim oForm
oForm = oEv.Source.Model.Parent
dtSearch= oForm.getByName( "dtDateFilter" )
dtStr = dtSearch.date
oForm.Filter = "startDate = " & "{D '" & left( dtStr, 4 ) & "-" &
mid( dtStr, 5, 2 ) & "-" & right( dtStr, 2 ) & "' }"
oForm.ApplyFilter = True
oForm.Reload
end sub
Drew
this works... but just thinking ahead here... where is it controlled
that the field is short date? It's not controlled on the form itself
(I tested) and it is not controlled by an underlying field 'cause
there isn't one. obviously, by using left, mid, and right, we are
expecting to not have the format change on us.
Walter,
Well they say that if you are lucky you don't stop learning till he day
you stop breathing.
I need to retract that statement about a date control's text property
returning a short date formatted string. I really thought it did, and I
think maybe it did at one time ( may be totally wrong on that also )
but under 2.0.3 and OOD680_m1 it does not. It returns a null string. I
shouldn't be surprised as the API documentation states that the TEXT
property for a unoUnoControlDateFieldModel is OPTIONAL!
However, the API documentation does however show that the DATE property
for a date control returns a string formatted as YYYYMMDD, period.
Finally, the first example failed for two reasons: First I used the word
"assuming" as a preamble. I should know better then ever use that word,
it is like washing ones car and then not expecting it to rain later that
same day :-) In fact the minute I hit send on the first email I said
to myself, "Of course he doesn' have it bound, it is to set a filter...DUUH"
The second and actual reason is, I believe, ( a better way to say
assuming ) precisely because you are using the control to get a date for
the filter - therefore not binding to a column in a rowset. This means
the line "dtVal = dtSearch.BoundField.getDate" fails because
dtSearch.BoundField returns NULL, not a rowset column.
But for the sake of conversation if the control where bound to a column
of a rowset then the method getDate would have returned a date
structure. ( a 'com.sun.star.util.date' to be precise ) This is not the
same as a BASIC date variable. This structure has three members YEAR,
MONTH and DAY each of type unsigned short.
OK, well I bet that has cleard things up for you. :-\
Drew
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]