-
January 19th, 2011, 06:47 AM
#1
problem in formula
Dear All,
i am using cr 8.5, vb6 & MS Access 2007.
My problem is that when i am trying to fetch data from access with the help of formula i receive this error:
A number, currency amount, boolean, date, time, date-time, or string is expected here.
this is my code as mentioned below:
Me.MousePointer = vbHourglass
If Combo1.Text = "" Then
Inventrymain.cr1.ReportFileName = App.Path + "\chartofaccounts.rpt"
Inventrymain.cr1.Connect = ";Pwd=" & "system"
Inventrymain.cr1.RetrieveDataFiles
Inventrymain.cr1.DiscardSavedData = True
Inventrymain.cr1.ReportSource = 0
Inventrymain.cr1.WindowTitle = " Chart of Items "
strformula = "{subcodes.accode}<> 0 "
Inventrymain.cr1.ReplaceSelectionFormula (strformula)
Inventrymain.cr1.WindowState = crptMaximized
Unload Me
On Error Resume Next
Inventrymain.cr1.Action = 1
Else
Inventrymain.cr1.ReportFileName = App.Path + "\chartofaccounts.rpt"
Inventrymain.cr1.Connect = ";Pwd=" & "system"
Inventrymain.cr1.RetrieveDataFiles
Inventrymain.cr1.DiscardSavedData = True
Inventrymain.cr1.ReportSource = 0
Inventrymain.cr1.WindowTitle = " Chart of Items "
strformula = "{subcodes.accode} = " & Combo2.Text & ""
Inventrymain.cr1.ReplaceSelectionFormula (strformula)
Inventrymain.cr1.WindowState = crptMaximized
Unload Me
On Error Resume Next
Inventrymain.cr1.Action = 1
End If
Private Sub Form_Load()
con
Set rs = cn.Execute("select Distinct accode,acname from subcodes order by accode")
Do While Not rs.EOF
Combo1.AddItem rs(0) & " - " & rs(1)
Combo2.AddItem rs(0)
rs.MoveNext
Loop
End Sub
in access database accode & acname all are text string.
please help me about this issue.
thnx in advance
-
January 19th, 2011, 05:23 PM
#2
Re: problem in formula
If the field is strig type then enclose the constant between ' , as in the next example
Code:
strformula = "{subcodes.accode} <> '0'"
...
...
strformula = "{subcodes.accode} = " & Chr(39) & Combo2.Text & chr(39)
JG
Last edited by jggtz; January 19th, 2011 at 05:26 PM.
-
January 20th, 2011, 02:45 AM
#3
Re: problem in formula
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|