Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: problem in formula Post Reply Post New Topic
Author Message
salman1karim
Newbie
Newbie
Avatar

Joined: 19 Jan 2011
Location: Kuwait
Online Status: Offline
Posts: 2
Quote salman1karim Replybullet Topic: problem in formula
     Posted: 19 Jan 2011 at 12:38am
Dear All,
 
This is my first post and i am begnier level in crystal report. 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
IP IP Logged
salman1karim
Newbie
Newbie
Avatar

Joined: 19 Jan 2011
Location: Kuwait
Online Status: Offline
Posts: 2
Quote salman1karim Replybullet Posted: 19 Jan 2011 at 8:47pm

prblem solved

IP IP Logged
Printable version Printable version

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