PDA

View Full Version : Solved: Run-time error '3464' Data type mismatch in criteria expression?



Erdin? E. Ka
02-23-2007, 04:15 PM
Hi everyone, :hi:

I am getting some datas from mdb database. But while i reseaching on UserForm called TesellumSilmeD?zeltme; I am typing on cmdFisNo named textbox for find the data on C:\Tesellum\Veriler.mdb
i am getting a error message as:

(Data type of the Vdatabase is "Long Integer")

Run-time error '3464' Data type mismatch in criteria expression.

Any suggestions?:doh:

Thanks a lot.

Erdin? E. Ka
02-23-2007, 04:16 PM
And i added zip of Veriler.mdb file.

mdmackillop
02-23-2007, 04:26 PM
Hi Erdinc, I can't open your first zipped file.

Erdin? E. Ka
02-24-2007, 06:30 AM
Hi Erdinc, I can't open your first zipped file.

Hi Malcolm, :hi:

Actually i don't know what is the reason for this, i tried to open it in my computer and i opened but, no matter i am one more posting the file.

Thank you very much to kindly care.:friends:

mdmackillop
02-24-2007, 08:05 AM
I got the file this time, but now it says it has "lost" the VB project. Can you post the code to go with the workbook.

Erdin? E. Ka
02-24-2007, 03:51 PM
I got the file this time, but now it says it has "lost" the VB project. Can you post the code to go with the workbook.


Ok.

This codes belong to userform called: TesellumSilmeD?zeltme


Option Explicit
Const Yol = "C:\Tesellum\Veriler.mdb"
Public nesne, nesneB
Public Boyut As Integer
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strSQLB As String
Dim veriAl, veriAlB
Dim Soru As Variant
Private Sub cmbgonAd_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT * FROM GonderenCariKart WHERE AdıSoyadi='" & cmbgonAd.Value & "'"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
If cmbgonAd.Value = "" Then
GoTo Atla
End If
If rst!AdıSoyadi <> cmbgonAd.Value Then
Soru = MsgBox("Bu Kayıt Mevcut Diğil Yeni Kayıt Girmek İstiyomusunuz ?", vbYesNo, "YENİ KAYIT")
If Soru = 6 Then
YeniKayıt.txtAdiSoyadi.Value = cmbgonAd.Value
YeniKayıt.txtHat.Visible = False
YeniKayıt.Label6.Visible = False
YeniKayıt.Show
Else
cmbgonAd.SetFocus
End If
End If
Atla:
txtgonAdres.Value = rst!Adresi
txtgonVdaire.Value = rst!VergiDairesi
txtgonVno.Value = rst!VergiNumarası
Call UserForm_Initialize
rst.Close
db.Close
End Sub
Private Sub cmbalacakAd_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT * FROM AlacakCariKart WHERE AdıSoyadi='" & cmbalacakAd.Value & "'"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
If cmbalacakAd.Value = "" Then
GoTo Atla
End If
If rst!AdıSoyadi <> cmbalacakAd.Value Then
Soru = MsgBox("Bu Kayıt Mevcut Diğil Yeni Kayıt Girmek İstiyomusunuz ?", vbYesNo, "YENİ KAYIT")
If Soru = 6 Then
YeniKayıt.txtAdiSoyadi.Value = cmbalacakAd.Value
YeniKayıt.Show
Exit Sub
End If
End If
Atla:
txtalacakAdres.Value = rst!Adresi
txtalanVdaire.Value = rst!VergiDairesi
txtalacakVno.Value = rst!VergiNumarası
Call UserForm_Initialize
rst.Close
db.Close
End Sub
Private Sub btnKaydet_Click()
Dim rs As Recordset
' Yeni = InputBox("GİR")
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
Set rs = db.OpenRecordset("SELECT * FROM Gonderen WHERE AdıSoyadi='" & cmbgonAd.Value & "'")
If rs.EOF Then
MsgBox "GE?ERLİ KAYIT YOK"
rs.AddNew
Else
rs.Edit
End If
rs!Adet = txtadet1.Value
rs.Update
End Sub
Private Sub btn_sil_Click()
Dim rs As Recordset
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
Set rs = db.OpenRecordset("SELECT * FROM Gonderen WHERE AdıSoyadi='" & cmbgonAd.Value & "'")
If Not rs.EOF Then
rs.Delete
End If
db.Close
End Sub

Private Sub cmdFisNo_Exit(ByVal Cancel As MSForms.ReturnBoolean)
'On Error Resume Next
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT * FROM Gonderen WHERE FisNo=' " & Val(cmdFisNo.Value) & " '"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
If cmdFisNo.Value = "" Then
GoTo Atla
End If
If rst!Fisno <> cmdFisNo.Value Then
Soru = MsgBox("Bu Kayıt Mevcut Diğil Yeni Kayıt Girmek İstiyomusunuz ?", vbYesNo, "YENİ KAYIT")
If Soru = 6 Then
YeniKayıt.txtAdiSoyadi.Value = cmbgonAd.Value
YeniKayıt.txtHat.Visible = False
YeniKayıt.Label6.Visible = False
YeniKayıt.Show
Else
cmdFisNo.SetFocus
End If
End If
Atla:
cmbalacakAd.Value = rst!AdıSoyadi
cmdTarih.Value = rst!Tarih
txtgonAdres.Value = rst!Adresi
txtgonVdaire.Value = rst!VergiDairesi
txtgonVno.Value = rst!VergiNumarası
txtgonSno.Value = rst!SevkirsNo
txtadet1.Value = rst!Adet
txtkap1.Value = rst!Kap
cmbHesap1.Value = rst!HesapSekli
cmbCinsi1.Value = rst!Cinsi
txtKilo1.Value = rst!Kilosu
' txtBirim1.Value = rst!BirimFiyatı
txtTutar1.Value = rst!Tutar
'Call UserForm_Initialize
rst.Close
db.Close
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub OptionButton1_Click()
If TesellumSilmeD?zeltme.Height = 486 Then
cmdFisNo.SetFocus
OptionButton1.Enabled = False
OptionButton2.Enabled = True
OptionButton3.Enabled = True
Else
TesellumSilmeD?zeltme.Height = 486
cmdFisNo.SetFocus
OptionButton1.Enabled = False
End If
End Sub
Private Sub OptionButton2_Click()
If TesellumSilmeD?zeltme.Height = 486 Then
cmbalacakAd.SetFocus
OptionButton2.Enabled = False
OptionButton1.Enabled = True
OptionButton3.Enabled = True
Else
TesellumSilmeD?zeltme.Height = 486
cmbalacakAd.SetFocus
OptionButton2.Enabled = False
End If
End Sub
Private Sub OptionButton3_Click()
If TesellumSilmeD?zeltme.Height = 486 Then
cmbgonAd.SetFocus
OptionButton3.Enabled = False
OptionButton1.Enabled = True
OptionButton2.Enabled = True
Else
TesellumSilmeD?zeltme.Height = 486
cmbgonAd.SetFocus
OptionButton3.Enabled = False
End If
End Sub
Private Sub UserForm_Initialize()
Dim rs As DAO.Recordset
' cmdTarih.Value = Format(Date, "dd/mm/yyyy;@")
cmdTarih.TextAlign = fmTextAlignCenter
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT AdıSoyadi FROM GonderenCariKart"
strSQLB = "SELECT AdıSoyadi FROM AlacakCariKart"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
Set rs = db.OpenRecordset(strSQLB, dbOpenDynaset, dbReadOnly)
Do While Not rst.EOF
For Each veriAl In rst.Fields
cmbgonAd.AddItem (veriAl)
Next veriAl
rst.MoveNext
Loop
Do While Not rs.EOF
For Each veriAlB In rs.Fields
cmbalacakAd.AddItem (veriAlB)
Next veriAlB
rs.MoveNext
Loop
rst.Close
rs.Close
End Sub



This codes belong to userform called: Tesellum


Option Explicit
Const Yol = "C:\Tesellum\Veriler.mdb"
Public nesne, nesneB
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strSQLB As String
Dim veriAl, veriAlB
Dim Soru As Variant
Private Sub btnKaydet_Click()
Dim db, dbB As Database, rs, rsB As Recordset
Set db = OpenDatabase(Yol)
Set dbB = OpenDatabase(Yol)
Set rs = db.OpenRecordset("Gonderen", dbOpenTable)
Set rsB = dbB.OpenRecordset("Alacak", dbOpenTable)

' If cmdFisNo.Value = rs.Fields("FisNo") Then
' MsgBox "Aynı Nolu Fiş Kayıtlı"
' cmbgonAd.SetFocus
' Exit Sub
' End If
If cmbgonAd.Value = "" Then
MsgBox "ALANLARI DOLDURUNUZ"
Exit Sub
End If
On Error Resume Next
With rs
.AddNew
.Fields("FisNo") = cmdFisNo.Value
.Fields("Tarih") = cmdTarih.Value
.Fields("AdıSoyadi") = cmbgonAd.Value
.Fields("Adresi") = txtgonAdres.Value
.Fields("VergiDairesi") = txtgonVdaire.Value
.Fields("VergiNumarası") = txtgonVno.Value
.Fields("SevkirsNo") = txtgonSno.Value
.Fields("Adet") = txtadet1.Value
.Fields("Kap") = txtkap1.Value
.Fields("HesapSekli") = cmbHesap1.Value
.Fields("Cinsi") = cmbCinsi1.Value
.Fields("Kilosu") = txtKilo1.Value
.Fields("BirimFiyatı") = txtBirim1.Value
.Fields("Tutar") = txtTutar1.Value
.Fields("Adet2") = txtadet2.Value
.Fields("Kap2") = txtkap2.Value
.Fields("HesapSekli2") = cmbHesap2.Value
.Fields("Cinsi2") = cmbCinsi2.Value
.Fields("Kilosu2") = txtKilo2.Value
.Fields("BirimFiyatı2") = txtBirim2.Value
.Fields("Tutar2") = txtTutar2.Value
.Fields("Adet3") = txtadet3.Value
.Fields("Kap3") = txtkap3.Value
.Fields("HesapSekli3") = cmbHesap3.Value
.Fields("Cinsi3") = cmbCinsi3.Value
.Fields("Kilosu3") = txtKilo3.Value
.Fields("BirimFiyatı3") = txtBirim3.Value
.Fields("Tutar3") = txtTutar3.Value
.Fields("NakliyeUcreti") = cmbNakliye?creti.Value
.Fields.Refresh
.Update
End With
With rsB
.AddNew
.Fields("FisNo") = cmdFisNo.Value
.Fields("Tarih") = cmdTarih.Value
.Fields("AdıSoyadi") = cmbalacakAd.Value
.Fields("Adresi") = txtalacakAdres.Value
.Fields("VergiDairesi") = txtalanVdaire.Value
.Fields("VergiNumarası") = txtalacakVno.Value
.Fields("SevkirsNo") = txtgonSno.Value
.Fields("Adet") = txtadet1.Value
.Fields("Kap") = txtkap1.Value
.Fields("HesapSekli") = cmbHesap1.Value
.Fields("Cinsi") = cmbCinsi1.Value
.Fields("Kilosu") = txtKilo1.Value
.Fields("BirimFiyatı") = txtBirim1.Value
.Fields("Tutar") = txtTutar1.Value
.Fields("Adet2") = txtadet2.Value
.Fields("Kap2") = txtkap2.Value
.Fields("HesapSekli2") = cmbHesap2.Value
.Fields("Cinsi2") = cmbCinsi2.Value
.Fields("Kilosu2") = txtKilo2.Value
.Fields("BirimFiyatı2") = txtBirim2.Value
.Fields("Tutar2") = txtTutar2.Value
.Fields("Adet3") = txtadet3.Value
.Fields("Kap3") = txtkap3.Value
.Fields("HesapSekli3") = cmbHesap3.Value
.Fields("Cinsi3") = cmbCinsi3.Value
.Fields("Kilosu3") = txtKilo3.Value
.Fields("BirimFiyatı3") = txtBirim3.Value
.Fields("Tutar3") = txtTutar3.Value
.Fields("NakliyeUcreti") = cmbNakliye?creti.Value
.Fields.Refresh
.Update
End With

MsgBox "Kayıt Eklendi"
Call UserForm_Initialize
For Each nesne In Controls
If TypeName(nesne) = "TextBox" Then
nesne.Value = ""
End If
Next nesne

For Each nesneB In Controls
If TypeName(nesneB) = "ComboBox" Then
nesneB.Value = ""
End If
Next nesneB
cmbgonAd.SetFocus
cmdTarih.Value = Format(Date, "dd/mm/yyyy;@")
cmdTarih.TextAlign = fmTextAlignCenter
cmdFisNo.ControlSource = "Veri!A1"
cmdFisNo.Value = cmdFisNo.Value + 1
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
rsB.Close
Set rsB = Nothing
dbB.Close
Set dbB = Nothing
End Sub
Private Sub cmbalacakAd_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT * FROM AlacakCariKart WHERE AdıSoyadi='" & cmbalacakAd.Value & "'"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
If cmbalacakAd.Value = "" Then
GoTo Atla
End If
If rst!AdıSoyadi <> cmbalacakAd.Value Then
Soru = MsgBox("Bu Kayıt Mevcut Diğil Yeni Kayıt Girmek İstiyomusunuz ?", vbYesNo, "YENİ KAYIT")
If Soru = 6 Then
YeniKayıt.txtAdiSoyadi.Value = cmbalacakAd.Value
YeniKayıt.Show
Exit Sub
End If
End If
Atla:
txtalacakAdres.Value = rst!Adresi
txtalanVdaire.Value = rst!VergiDairesi
txtalacakVno.Value = rst!VergiNumarası
Call UserForm_Initialize
rst.Close
db.Close
End Sub
Private Sub cmbgonAd_Exit(ByVal Cancel As MSForms.ReturnBoolean)
On Error Resume Next
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT * FROM GonderenCariKart WHERE AdıSoyadi='" & cmbgonAd.Value & "'"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
If cmbgonAd.Value = "" Then
GoTo Atla
End If
If rst!AdıSoyadi <> cmbgonAd.Value Then
Soru = MsgBox("Bu Kayıt Mevcut Diğil Yeni Kayıt Girmek İstiyomusunuz ?", vbYesNo, "YENİ KAYIT")
If Soru = 6 Then
YeniKayıt.txtAdiSoyadi.Value = cmbgonAd.Value
YeniKayıt.txtHat.Visible = False
YeniKayıt.Label6.Visible = False
YeniKayıt.Show
Else
cmbgonAd.SetFocus
End If
End If
Atla:
txtgonAdres.Value = rst!Adresi
txtgonVdaire.Value = rst!VergiDairesi
txtgonVno.Value = rst!VergiNumarası
Call UserForm_Initialize
rst.Close
db.Close

End Sub

Private Sub cmbNakliye?creti_Change()
If cmbNakliye?creti.Value = "Havale" Then
cmbHat.Value = "KAYSERİ"
End If
If cmbNakliye?creti.Value = "Peşin" Then
cmbHat.Value = "İSTANBUL"
End If
End Sub
Private Sub txtalacakAdres_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If Not txtalacakAdres.Value = "" Then
txtadet1.SetFocus
End If
End Sub
Private Sub txtBirim1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
txtBirim1.Value = Replace(txtBirim1.Value, ",", ".")
If cmbHesap1.Value = "ADET" Then
txtTutar1.Value = Val(txtadet1.Value) * Val(txtBirim1.Value)
ElseIf cmbHesap1.Value = "" Then
txtTutar1.Value = Val(txtadet1.Value) * Val(txtBirim1.Value)
Else
txtTutar1.Value = Val(txtKilo1.Value) * Val(txtBirim1.Value)
End If
End Sub
Private Sub txtBirim2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
txtBirim2.Value = Replace(txtBirim2.Value, ",", ".")
If cmbHesap2.Value = "ADET" Then
txtTutar2.Value = Val(txtadet2.Value) * Val(txtBirim2.Value)
ElseIf cmbHesap2.Value = "" Then
txtTutar2.Value = Val(txtadet2.Value) * Val(txtBirim2.Value)
Else
txtTutar2.Value = Val(txtKilo2.Value) * Val(txtBirim2.Value)
End If
End Sub
Private Sub txtBirim3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
txtBirim3.Value = Replace(txtBirim3.Value, ",", ".")
If cmbHesap3.Value = "ADET" Then
txtTutar3.Value = Val(txtadet3.Value) * Val(txtBirim3.Value)
ElseIf cmbHesap3.Value = "" Then
txtTutar3.Value = Val(txtadet3.Value) * Val(txtBirim3.Value)
Else
txtTutar3.Value = Val(txtKilo3.Value) * Val(txtBirim3.Value)
End If
End Sub
Private Sub txtgonAdres_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
If Not txtgonAdres.Value = "" Then
cmbalacakAd.SetFocus
End If
End Sub
Private Sub UserForm_Initialize()

Dim rs As DAO.Recordset
cmdTarih.Value = Format(Date, "dd/mm/yyyy;@")
cmdTarih.TextAlign = fmTextAlignCenter
cmbNakliye?creti.AddItem ("Havale")
cmbNakliye?creti.AddItem ("Peşin")
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT AdıSoyadi FROM GonderenCariKart"
strSQLB = "SELECT AdıSoyadi FROM AlacakCariKart"

Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
Set rs = db.OpenRecordset(strSQLB, dbOpenDynaset, dbReadOnly)

Do While Not rst.EOF

For Each veriAl In rst.Fields
cmbgonAd.AddItem (veriAl)
Next veriAl

rst.MoveNext
Loop

Do While Not rs.EOF

For Each veriAlB In rs.Fields
cmbalacakAd.AddItem (veriAlB)
Next veriAlB

rs.MoveNext
Loop

rst.Close
rs.Close
End Sub


This codes belong to userform called: YeniKayıt


Option Explicit
Const Yol = "C:\Tesellum\Veriler.mdb"
Public nesne, nesneB
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Dim strSQLB As String
Private Sub btnKaydet_Click()
Dim db, dbB As Database, rs, rsB As Recordset
Set db = OpenDatabase(Yol)
Set dbB = OpenDatabase(Yol)
Set rs = db.OpenRecordset("GonderenCariKart", dbOpenTable)
Set rsB = dbB.OpenRecordset("AlacakCariKart", dbOpenTable)
On Error Resume Next

If txtAdiSoyadi.Value = "" Then
MsgBox "ALANLARI DOLDURUNUZ"
Exit Sub
End If
If Not Tesellum.cmbalacakAd.Value = "" Then
GoTo Soru1
End If
If txtHat.Value = 1 Then
Soru1:
If txtHat.Value = "" Or txtHat.Value <> 1 Then
MsgBox "ALACAK M?ŞTERİ HAT KODUNU GİRMELİSİNİZ"
Exit Sub
End If
With rsB
.AddNew
Tesellum.cmbalacakAd.Value = txtAdiSoyadi.Value
.Fields("AdıSoyadi") = txtAdiSoyadi.Value
.Fields("Adresi") = txtAdres.Value
.Fields("ilce") = txtilce.Value
.Fields("il") = txtilce.Value
.Fields("Tel") = txtTel.Value
.Fields("Faks") = txtFaks.Value
.Fields("VergiDairesi") = txtVDaire.Value
.Fields("VergiNumarası") = txtVNumarası.Value
.Fields("Hat") = txtHat.Value
.Fields.Refresh
.Update
End With

Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT * FROM AlacakCariKart WHERE AdıSoyadi='" & txtAdiSoyadi.Value & "'"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
Tesellum.txtalacakAdres.Value = rst!Adresi
Tesellum.txtalanVdaire.Value = rst!VergiDairesi
Tesellum.txtalacakVno.Value = rst!VergiNumarası
Else
With rs
.AddNew
Tesellum.cmbgonAd.Value = txtAdiSoyadi.Value
.Fields("AdıSoyadi") = txtAdiSoyadi.Value
.Fields("Adresi") = txtAdres.Value
.Fields("ilce") = txtilce.Value
.Fields("il") = txtilce.Value
.Fields("Tel") = txtTel.Value
.Fields("Faks") = txtFaks.Value
.Fields("VergiDairesi") = txtVDaire.Value
.Fields("VergiNumarası") = txtVNumarası.Value
.Fields.Refresh
.Update
End With
Set db = DBEngine.Workspaces(0).OpenDatabase(Yol)
strSQL = "SELECT * FROM GonderenCariKart WHERE AdıSoyadi='" & txtAdiSoyadi.Value & "'"
Set rst = db.OpenRecordset(strSQL, dbOpenDynaset, dbReadOnly)
Tesellum.txtgonAdres.Value = rst!Adresi
Tesellum.txtgonVdaire.Value = rst!VergiDairesi
Tesellum.txtgonVno.Value = rst!VergiNumarası
End If

MsgBox "Kayıt Eklendi"
Unload Me
For Each nesne In Controls
If TypeName(nesne) = "TextBox" Then
nesne.Value = ""
End If
Next nesne

For Each nesneB In Controls
If TypeName(nesneB) = "ComboBox" Then
nesneB.Value = ""
End If
Next nesneB
Unload YeniKayıt
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
rsB.Close
Set rsB = Nothing
dbB.Close
Set dbB = Nothing
End Sub
Private Sub btnVazgec_Click()
Unload Me
End Sub


Thank you very much Malcolm. :hi:

mdmackillop
02-24-2007, 04:32 PM
This will take a bit of work to put together, if it's possible. This line,
along wih a few others is translating the final character here
Tesellum.txtgonVno.Value = rst!VergiNumarası

as ?, which causes a compile error in the code here.

Erdin? E. Ka
03-04-2007, 09:07 PM
Hi Malcolm,

My friend is Aytan was found the problem yesterday and it's resolved anymore. : pray2:

I attached the editied file here.

Thank you very much to help.:friends: