6 Replies - 1427 Views - Last Post: 06 May 2013 - 10:13 PM Rate Topic: -----

#1 Kaito1412  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-April 13

[ASK] type mismatch in Crystal Report

Posted 29 April 2013 - 11:06 PM

Hi Everyone :bigsmile:/>
i have a problem in my code, the data which i want to print to Crystal Report is Ok and show up in Crystal Report, but the problem is when i run it, it always give me an error message Type Mismatch, and its difficult to trace that error :2guns:/>
here is my code
Private Sub cmdPrint_Click()
Call Buka
Dim pil1 As New ADODB.Recordset
Dim sql1, pilihan1, strdata As String
Dim a1, b1 As Date
a1 = tglawal.Value
b1 = tglakhir.Value
pilihan1 = cbpilihan.Text
Set cryApp = New CRAXDRT.Application
Set rptApp = cryApp.OpenReport("C:\Documents and Settings\NKP\Desktop\crush it\Report\rptpinjam.rpt")
Select Case pilihan1
                Case "All"
                                sql1 = "select m.no_faktur,m.pemohon,m.peminjam, b.nama ,d.jumlah_mnt,d.jumlah_app,d.tgl_pnjm,d.tgl_kmbl,d.approve,d.keterangan from dtl_pinjam d inner join dtl_barang b on d.id_barang = b.id_barang inner join mspeminjaman m on d.no_faktur = m.no_faktur order by d.no_faktur asc;"
                                Set pil1 = Conn.Execute(sql1)
                                
                Case "Tanggal"
                                sql1 = "Call viewpnjmbytgl('" & a1 & "','" & b1 & "')"
                                Set pil1 = Conn.Execute(sql1)
                                
                Case "Belum disetujui"
                                sql1 = "Call viewpinjamblmck"
                                Set pil1 = Conn.Execute(sql1)
                                
                Case "Disetujui"
                                sql1 = "Call viewpinjambyapp"
                                Set pil1 = Conn.Execute(sql1)
                                
                Case "Ditolak"
                                sql1 = "Call viewpinjambyrjct"
                                Set pil1 = Conn.Execute(sql1)
                                
End Select
                rptApp.Database.SetDataSource pil1
                PrintPreview.CRViewer1.ReportSource = rptApp
                PrintPreview.CRViewer1.ViewReport
                PrintPreview.CRViewer1.Zoom 100
                PrintPreview.Show
                PrintPreview.WindowState = 2
End Sub


and .ttx file :
no_faktur String 50
pemohon String 50
peminjam String 50
nama String 100
jumlah_mnt Number
jumlah_app Number
tgl_pnjm Date
tgl_kmbl Date
approve String 50
keterangan String 225

i'm really appreciate who answer my question, thank you very much :bigsmile:/>

Is This A Good Question/Topic? 0
  • +

Replies To: [ASK] type mismatch in Crystal Report

#2 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: [ASK] type mismatch in Crystal Report

Posted 02 May 2013 - 08:18 PM

It's a whole lot more difficult for anyone else to trace your error when you fail to give us important relevant information.
Was This Post Helpful? 0
  • +
  • -

#3 Kaito1412  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-April 13

Re: [ASK] type mismatch in Crystal Report

Posted 02 May 2013 - 08:49 PM

View PostBobRodes, on 02 May 2013 - 08:18 PM, said:

It's a whole lot more difficult for anyone else to trace your error when you fail to give us important relevant information.


Thanks Bob for response, my trouble is when i run that program, the data which i want to print is shown but always get message box "Type Mismatch", i had make the type data same as type data in database and in file .ttx, that's why i'm really confuse where did i make mistake in my code or my crystal report design. i'm really grateful if you can help me :bigsmile:

that file which i attach, i modified to try another trick to execute, but have a same problem with

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#4 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: [ASK] type mismatch in Crystal Report

Posted 03 May 2013 - 05:21 PM

Well, what information about this do you think might be helpful, that you haven't provided yet? And please don't expect people to download files and run them on their own machine. Too many malicious programs out there.
Was This Post Helpful? 0
  • +
  • -

#5 Kaito1412  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-April 13

Re: [ASK] type mismatch in Crystal Report

Posted 05 May 2013 - 06:06 PM

Ok Bob, my trouble is

1. message box of type mismatch always shown when i click print button, but the data which i want to print is right that shown in my crystal report.

What i did recently:
1. i design my crystal report in vb 6.0 by add crystal report in my project
2. i had make the data type in my crystal report design same as data type in my database
3. recently i use this technique to show my data in crystal report
Adodc1.RecordSource = sql1
                Adodc1.Refresh
                CRpeminjaman.Database.SetDataSource Adodc1.Recordset
                PrintPreview.CRViewer1.ReportSource = CRpeminjaman
                PrintPreview.CRViewer1.ViewReport
                PrintPreview.CRViewer1.Zoom 100
                PrintPreview.Show
                PrintPreview.WindowState = 2



what i still confuse:
1. what must i do to trace that type mismatch error? i had check my CR design, data type in my database, my query that run well.
2. is Date format is really impact to this? my CR design is DATETIME, n my db design is DATETIME too such as dd/mm/yyyy h:mm:ss
3. is null field is really impact too? some of my field is null.

Thanks Bob for your response, i hope that i give you information that you need to help me. i'm sorry if i misunderstand what you said to me. have a nice day
Was This Post Helpful? 0
  • +
  • -

#6 Kaito1412  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-April 13

Re: [ASK] type mismatch in Crystal Report

Posted 05 May 2013 - 08:57 PM

for the error picture

Attached image(s)

  • Attached Image

Was This Post Helpful? 0
  • +
  • -

#7 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: [ASK] type mismatch in Crystal Report

Posted 06 May 2013 - 10:13 PM

Ok, so this happens when you execute the Show method? Also, one of the things you can do is google "crystal reports type mismatch" and read the agonies that other people go through with this.

This post has been edited by BobRodes: 06 May 2013 - 10:15 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1