473,408 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

How to fix "ERROR Data type mismatch"?

How can i fix the error?

Private Sub cmdadd2_Click()
If cmdadd2.Caption = "ADD" Then
cmdadd2.Caption = "SAVE"
cmdedit2.Caption = "CANCEL"
buttons True, False
a = Date
a = Right(a, 4)
With Adodc2.Recordset
.Filter = "IDnumber like 'F-" + a + "-*'"
If Adodc2.Recordset.RecordCount <> 0 Then
.MoveLast
c = !IDnumber
idn = Right(!IDnumber, 4)
idn = idn + 1
b = Len(idn)

.Filter = "isdeleted = 0"
txtpass2.Text = GenerateCode()
.AddNew

If b = 1 Then

txtid.Text = "F-" + a + "-000" + idn
ElseIf b = 2 Then

txtid.Text = "F-" + a + "-00" + idn
ElseIf b = 3 Then

txtid.Text = "F-" + a + "-0" + idn

ElseIf b = 4 Then

txtid.Text = "F-" + a + "-" + idn

Else
MsgBox "The system reached it's maximum capacity to accomodate new faculty members.", vbCritical, "System"

End If


Else

With Adodc2.Recordset
txtpass2.Text = GenerateCode()
.Filter = "isdeleted = 0"
.AddNew

txtid.Text = "F-" + a + "-0001"
End With

End If



End With




If (txtlname2.Text = "") And (txtfname2.Text = "") Then
MsgBox "Please Fill Out the Required fields"

Else

With Adodc2.Recordset


!IDnumber = txtid.Text
!isdeleted = 0
!lname = txtlname2.Text
!fname = txtfname2.Text
!mname = txtmname2.Text
!gender = txtgender2.Text
!DOBirth = txtmo2.Text & Me.txtd2.Text & Me.txtcity2.Text
!PBirth = txtpobirth2.Text
!degree = txtdeg.Text
!doctorate = txtdoc.Text
!masteral = txtmas.Text
!college = txtcol.Text
!college3 = txtcol3.Text
!college2 = txtcol2.Text
!eadd = txteadd2.Text
!address = txtaddress2.Text
!city = txtcity2.Text
!province = txtstate2.Text
!postalCode = txtpostal2.Text
!cnumber = txtcnumber2.Text
!passcode = txtpass2.Text
.Update




With login.Adodc1.Recordset

.AddNew
!IDNO = Text1.Text
!passcode = txtpass.Text
!isdeleted = 0
!isStudent = 0
!isAdmin = 0
!isTeacher = 1
.Update
End With


.Filter = "isdeleted = 0"


End With


cmdadd2.Caption = "ADD"
cmdedit2.Caption = "EDIT"
buttons False, True

End If

End If

End Sub
Attached Images
File Type: jpg 1.jpg (46.3 KB, 344 views)
Jan 14 '11 #1
1 2576
code green
1,726 Expert 1GB
It means you are trying to copy a data type, say of string into maybe an integer
Jan 14 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: s_gregory | last post by:
The mdb is considerable size 70 +- mb. A complex union query was working well, but when an additional union select... was added into the query, selecting identical fields from a different source,...
1
by: ApexData | last post by:
Access2k I WAS getting the following error when using the MID function: Run Time Error '13' Type Mismatch I have a new single form, unbound with 1-button on it that uses the following code:...
1
by: jmarr02s | last post by:
I am using MS Access 2003 and get the following error "Data type mismatch in criteria expression" Any suggestions on how to fix this? This is my code: SELECT IIf(=15 Or =19, "15 og 19",...
5
by: Davros9 | last post by:
Trying to get Regular Expressions working....... ---------------- Public Function SepString(InField As String) As String ''seperates on space and comma Dim RE As New RegExp Dim Matches As...
3
by: martin DH | last post by:
I would definitely appreciate any help with this problem as soon as possible. Thanks! I have a report that should display the results of a query based on two tables (tblClient and tblResult,...
2
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm...
1
by: brboga | last post by:
Hello, VBA gives an error on the indicated line. "tblparameters" is a database which exists. Option Compare Database Option Explicit Sub fill_parameters()
1
by: Shelley Burke | last post by:
Many thanks for the coding provided in an earlier thread to be able to snapshot document, save as pdf and email it. Unfort I have done everything as instructed and am still having problems. ...
5
by: Knowlton | last post by:
I am trying to set the value of a varible using DLookup and keep getting a type mismatch error. Here is what I have: Dim lngPickupTrailer As Long 'get mileage where trailer was picked up...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.