Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding date conditions using vba 1

Status
Not open for further replies.

WP

Programmer
Nov 30, 1999
463
0
0
CH
Trying to add where condition from a from:
:
:
:
'Add the condition for from date
If Len(Me.cboFromDate) > 0 Then
Set boCond = bodp.Queries.Item(1).Conditions.Add("Rep Trades", "Execution Date", "Greater than or equal to", cboFromDate & "00:00:00")
CondFormatCount = 1
End If

'Add the condition for to Date
If Len(Me.cboToDate) > 0 Then
Set boCond = bodp.Queries.Item(1).Conditions.Add("Rep Trades", "Execution Date", "Less than or equal to", cboToDate & "23:59:59")
CondFormatCount = CondFormatCount + 1
End If
:
:
:


I get the error :

ORA-00907: missing right parenthesis : - 907

is there more to it with dates... do i need a to_date function?

Any help appreciated.

I feel as if I'm asking load here ... new to B.O. and still finding my feet.

Bill Paton


Check out
 
Try this

create a string containing the date in dd/mm/yyyy hh:nn:ss
format with single quotes around it

eg

dim ddd as string
ddd="'21/03/2003 12:00:00'"

then do

Set boCond = bodp.Queries.Item(1).Conditions.Add("Rep Trades", "Execution Date", "Greater than or equal to", ddd,"Constant")


I don't know whether the format of the date string matters or not - this is what I do for my reports and it works for me.

Hope this helps.

Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top