hi!
i'm new here.
i have problem with my database.
i asked my friend to key in data.
then, i want to combine all data together in ms access at my computer.
when i run the system the run time error "13" type mismatch appeared.
i don't know what this mean.
i asked my friend but he also don't know what to do.
can anybody tell me what should i do??
i have to get my system ready before this 10th ogos.
kheoyleon 0 Newbie Poster
abu taher 34 Practically a Posting Shark
type mismatch. its not match with your type. example: you work with some numeric number. you declare a variable Like
Dim a as string
so it show this msg. type mismatch. cause string value is not match with your work. you need to declare like:
Dim a as Integer
cause integer is for numeric value. same as other. here you not mention what you did. But I think it solve your problem.
kheoyleon 0 Newbie Poster
did you mean i have to declare every text box that i use to enter data?
abu taher 34 Practically a Posting Shark
not that. you declare it in general declaration. or you use module.
kheoyleon 0 Newbie Poster
why i have to declare?
the error happen when i paste the data into db
not the data that i added through the system
there is no problem if i added data through system
the system still can run
i just want to combine all data in my db
abu taher 34 Practically a Posting Shark
why i have to declare?
I just give u a example. paste your code.
kheoyleon 0 Newbie Poster
i have attach my code.
i have another question.
if the text box that i prepared is shorten than the data entered, can it add all the data in the text box?
last month this problem happened.
a message box appeared said that the text box is to small to enter a large data.
but some of the text box do not have the problem even the data is longer than the text box.
at first, i don't know that data is not added.
when i check the db, i can't find the data.
so i edit the text box to be more longer than before.
but that error still occured.
i changed the data type in db from text to memo.
then it can run well.
you think is this the problem why the type mismatch happen?
The attachment preview is chopped off after the first 10 KB. Please download the entire file.
Dim CN As New ADODB.Connection
Dim RS As New ADODB.Recordset
Private Sub cmd_add_Click()
On Error GoTo masalah
Dim holdvaluebox
holdvaluebox = MsgBox("Are you sure had fill in all blank box?", vbYesNo, "ATTENTION!")
If holdvaluebox = vbNo Then
GoTo masalah
Else
RS.Close
RS.Open "DB", CN, adOpenKeyset, adLockPessimistic, adCmdTable
RS.AddNew
RS.Fields("EXCHANGE") = txtexchange.Text
RS.Fields("MUKIM") = txtmukim.Text
RS.Fields("DAERAH") = txtdaerah.Text
RS.Fields("SERVING_CABINET") = txtkabinet.Text
RS.Fields("ES_WORKING") = txtes_working.Text
RS.Fields("ES_FREE") = txtes_free.Text
RS.Fields("ADSL_WORKING") = txtadsl_working.Text
RS.Fields("ADSL_FREE") = txtadsl_free.Text
RS.Fields("KAWASAN_PERINDUSTRIAN") = txtkawasan.Text
RS.Fields("NAMA_SYARIKAT") = txtsyarikat.Text
RS.Fields("ADDRESS") = txt_address.Text
RS.Fields("JENIS_INDUSTRI") = txtindustri.Text
RS.Fields("INDUSTRI_SEBUAH") = txtsebuah.Text
RS.Fields("INDUSTRI_TERES") = txtteres.Text
RS.Fields("KEMBAR") = txtkembar.Text
RS.Fields("TELEPHONE") = txttelephone.Text
RS.Fields("ADSL") = txtadsl.Text
RS.Fields("DATA") = txtdata.Text
RS.Fields("SEGMENT") = txtsegment.Text
RS.Fields("KELUASAN") = txtluas.Text
MsgBox "Data added!", vbInformation, "SUCCESFULL!"
txtexchange.Text = ""
txtmukim.Text = ""
txtdaerah.Text = ""
txtkabinet.Text = ""
txtes_working.Text = ""
txtes_free.Text = ""
txtadsl_working.Text = ""
txtadsl_free.Text = ""
txtkawasan.Text = ""
txtsyarikat.Text = ""
txt_address.Text = ""
txtindustri.Text = ""
txtsebuah.Text = ""
txtteres.Text = ""
txtkembar.Text = ""
txttelephone.Text = ""
txtadsl.Text = ""
txtdata.Text = ""
txtsegment.Text = ""
txtluas.Text = ""
RS.Update
reshow
End If
Exit Sub
masalah:
End Sub
Private Sub cmd_mainmenu_Click()
form_menu.Visible = True
VS_HDD.Visible = False
VS_IAD.Visible = False
VS_VD.Visible = False
VS_CCD.Visible = False
End Sub
Private Sub cmd_delete_Click()
On Error GoTo prob
Dim holdvaluebox
holdvaluebox = MsgBox("Are you sure want to delete this record", vbYesNo, "ATTENTION!")
If holdvaluebox = vbYes Then
RS.Delete
RS.Update
reshow
txtexchange.Text = ""
txtmukim.Text = ""
txtdaerah.Text = ""
txtkabinet.Text = ""
txtes_working.Text = ""
txtes_free.Text = ""
txtadsl_working.Text = ""
txtadsl_free.Text = ""
txtkawasan.Text = ""
txtsyarikat.Text = ""
txt_address.Text = ""
txtindustri.Text = ""
txtsebuah.Text = ""
txtteres.Text = ""
txtkembar.Text = ""
txttelephone.Text = ""
txtadsl.Text = ""
txtdata.Text = ""
txtsegment.Text = ""
txtluas.Text = ""
Else
Exit Sub
End If
Exit Sub
prob:
End Sub
Private Sub cmd_search_Click()
form_search.Visible = True
LV.Visible = False
cmd_mainmenu.Enabled = False
cmd_add.Enabled = False
cmd_search.Enabled = False
cmdupdate.Enabled = False
cmd_delete.Enabled = False
cmdrefresh.Enabled = False
cmdexit.Enabled = False
lbl_mainmenu.Enabled = False
lbl_add.Enabled = False
lbl_search.Enabled = False
lblupdate.Enabled = False
lbl_delete.Enabled = False
lblrefresh.Enabled = False
lblexit.Enabled = False
lblcounter3.Enabled = False
txtexchange.Enabled = False
txtmukim.Enabled = False
txtdaerah.Enabled = False
txtkabinet.Enabled = False
txtes_working.Enabled = False
txtes_free.Enabled = False
txtadsl_working.Enabled = False
txtadsl_free.Enabled = False
txtkawasan.Enabled = False
txtsyarikat.Enabled = False
txt_address.Enabled = False
txtindustri.Enabled = False
txtsebuah.Enabled = False
txtteres.Enabled = False
txtkembar.Enabled = False
txttelephone.Enabled = False
txtadsl.Enabled = False
txtdata.Enabled = False
txtsegment.Enabled = False
txtluas.Enabled = False
End Sub
Private Sub cmd_search2_Click()
RS.Close
RS.Open "SELECT * FROM DB WHERE SERVING_CABINET = '" & txtfind.Text & "' ", CN, adOpenKeyset, adLockPessimistic, adCmdText
txtfind.Text = ""
LV.ListItems.Clear
papar
txtexchange.Enabled = True
txtmukim.Enabled = True
txtdaerah.Enabled = True
txtkabinet.Enabled = True
txtes_working.Enabled = True
txtes_free.Enabled = True
txtadsl_working.Enabled = True
txtadsl_free.Enabled = True
txtkawasan.Enabled = True
txtsyarikat.Enabled = True
txt_address.Enabled = True
txtindustri.Enabled = True
txtsebuah.Enabled = True
txtteres.Enabled = True
txtkembar.Enabled = True
txttelephone.Enabled = True
txtadsl.Enabled = True
txtdata.Enabled = True
txtsegment.Enabled = True
txtluas.Enabled = True
cmd_mainmenu.Enabled = True
cmd_add.Enabled = True
cmd_search.Enabled = True
cmdupdate.Enabled = True
cmd_delete.Enabled = True
cmdrefresh.Enabled = True
cmdexit.Enabled = True
lbl_mainmenu.Enabled = True
lbl_add.Enabled = True
lbl_search.Enabled = True
lblupdate.Enabled = True
lbl_delete.Enabled = True
lblrefresh.Enabled = True
lblexit.Enabled = True
lblcounter3.Enabled = True
End Sub
Private Sub cmdupdate_Click()
On Error GoTo prob
RS.Fields("EXCHANGE") = txtexchange.Text
RS.Fields("MUKIM") = txtmukim.Text
RS.Fields("DAERAH") = txtdaerah.Text
RS.Fields("SERVING_CABINET") = txtkabinet.Text
RS.Fields("ES_WORKING") = txtes_working.Text
RS.Fields("ES_FREE") = txtes_free.Text
RS.Fields("ADSL_WORKING") = txtadsl_working.Text
RS.Fields("ADSL_FREE") = txtadsl_free.Text
RS.Fields("KAWASAN_PERINDUSTRIAN") = txtkawasan.Text
RS.Fields("NAMA_SYARIKAT") = txtsyarikat.Text
RS.Fields("ADDRESS") = txt_address.Text
RS.Fields("JENIS_INDUSTRI") = txtindustri.Text
RS.Fields("INDUSTRI_SEBUAH") = txtsebuah.Text
RS.Fields("INDUSTRI_TERES") = txtteres.Text
RS.Fields("KEMBAR") = txtkembar.Text
RS.Fields("TELEPHONE") = txttelephone.Text
RS.Fields("ADSL") = txtadsl.Text
RS.Fields("DATA") = txtdata.Text
RS.Fields("SEGMENT") = txtsegment.Text
RS.Fields("KELUASAN") = txtluas.Text
MsgBox "Data updated!", vbInformation, "SUCCESFULL!"
txtexchange.Text = ""
txtmukim.Text = ""
txtdaerah.Text = ""
txtkabinet.Text = ""
txtes_working.Text = ""
txtes_free.Text = ""
txtadsl_working.Text = ""
txtadsl_free.Text = ""
txtkawasan.Text = ""
txtsyarikat.Text = ""
txt_address.Text = ""
txtindustri.Text = ""
txtsebuah.Text = ""
txtteres.Text = ""
txtkembar.Text = ""
txttelephone.Text = ""
txtadsl.Text = ""
txtdata.Text = ""
txtsegment.Text = ""
txtluas.Text = ""
RS.Update
reshow
Exit Sub
prob:
End Sub
Private Sub cmdexit_Click()
End
End Sub
Private Sub cmdexit3_Click()
End
End Sub
Private Sub cmd_back2_Click()
LV.Visible = True
form_search.Visible = False
cmd_mainmenu.Enabled = True
cmd_add.Enabled = True
cmd_search.Enabled = True
cmdupdate.Enabled = True
cmd_delete.Enabled = True
cmdrefresh.Enabled = True
cmdexit.Enabled = True
l
selvaganapathy 31 Posting Pro
Hi,
Where you get error, Can u specify? Then only we can find error easily. That is the line in which the error occured.
kheoyleon 0 Newbie Poster
Private Sub papar()
LV.ListItems.Clear
maxdata = RS.RecordCount
lblcounter3.Caption = "TOTAL : " & RS.RecordCount & " data"
For i = 1 To maxdata
LV.ListItems.Add , , RS("SERVING_CABINET")
LV.ListItems(i).ListSubItems.Add 1, , RS.Fields("EXCHANGE")
LV.ListItems(i).ListSubItems.Add 2, , RS.Fields("MUKIM")
LV.ListItems(i).ListSubItems.Add 3, , RS.Fields("DAERAH")
LV.ListItems(i).ListSubItems.Add 4, , RS.Fields("ES_WORKING")
LV.ListItems(i).ListSubItems.Add 5, , RS.Fields("ES_FREE")
LV.ListItems(i).ListSubItems.Add 6, , RS.Fields("ADSL_WORKING")
LV.ListItems(i).ListSubItems.Add 7, , RS.Fields("ADSL_FREE")
LV.ListItems(i).ListSubItems.Add 8, , RS.Fields("KAWASAN_PERINDUSTRIAN")
LV.ListItems(i).ListSubItems.Add 9, , RS.Fields("NAMA_SYARIKAT")
LV.ListItems(i).ListSubItems.Add 10, , RS.Fields("ADDRESS")
LV.ListItems(i).ListSubItems.Add 11, , RS.Fields("JENIS_INDUSTRI")
LV.ListItems(i).ListSubItems.Add 12, , RS.Fields("INDUSTRI_SEBUAH")
LV.ListItems(i).ListSubItems.Add 13, , RS.Fields("INDUSTRI_TERES")
LV.ListItems(i).ListSubItems.Add 14, , RS.Fields("KEMBAR")
LV.ListItems(i).ListSubItems.Add 15, , RS.Fields("TELEPHONE")
LV.ListItems(i).ListSubItems.Add 16, , RS.Fields("ADSL")
LV.ListItems(i).ListSubItems.Add 17, , RS.Fields("DATA")
LV.ListItems(i).ListSubItems.Add 18, , RS.Fields("SEGMENT") <<<<<<HERE
LV.ListItems(i).ListSubItems.Add 19, , RS.Fields("KELUASAN")
i try to leave it as comment, it can run.
after a few trials, then the error goes to the next.
the data input include alphabet and number.
example s30, m20.
the data type that i choose in ms access is text.
can i use text if alphabet and number is the input?
kheoyleon 0 Newbie Poster
horay
my problem solved!
i change the data type and also the data in db
now i can run my program
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.