please someone help me..im doing my final project and below is my code for the registration form..after i fill up all my form and it will appear a msg box that i can only register once...the data is not being inserted in the database..im using ms access...please2....do help me...i dont know what is wrong...

Imports System.Data.OleDb
    Imports System.Text.RegularExpressions

    Public Class registration
        Private _Userid As Int32 = 0
        Public Property Userid() As Int32
            Get
                Return _Userid
            End Get

            Set(ByVal value As Int32)
                _Userid = value
                RetrieveContactDetails()
            End Set
        End Property
        Private Sub RetrieveContactDetails()

            Dim conn As New OleDbConnection("provider=microsoft.jet.OleDB.4.0;Data Source=D:\fnal projek\khurasan.mdb; Persist Security Info = false;")
            Dim command As New OleDbCommand("Select Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum from Customer Where Userid = " & _Userid, conn)

            conn.Open()

            Dim contactReader As OleDbDataReader = command.ExecuteReader
            contactReader.Read()
            TxtUname.Text = contactReader("Username").ToString
            TxtPwd.Text = contactReader("Password").ToString
            TxtName.Text = contactReader("Name").ToString
            TxtICNum.Text = contactReader("NumIC").ToString
            cmboxGndr.Text = contactReader("Gender").ToString
            TxtMail.Text = contactReader("Email").ToString
            Rtxtadd.Text = contactReader("Address").ToString
            TxtPhone.Text = contactReader("PhoneNum").ToString


            conn.Close()
        End Sub
        Private Sub Label4_Click(sender As System.Object, e As System.EventArgs) Handles Label4.Click

        End Sub

        Private Sub PictureBox1_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Click
            Dim dialogResult As DialogResult
            dialogResult = MsgBox("Are you sure you want to leave this system ? ", vbYesNo + vbExclamation, "Khurasan Online")

            If dialogResult = dialogResult.Yes Then
                Me.Close()
                Me.Dispose()


            End If
        End Sub

        Private Sub PictureBox2_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox2.Click
            Dim dialogResult As DialogResult
            dialogResult = MsgBox("Are you sure you want to leave this page ? ", vbYesNo + vbExclamation, "Khurasan Online")

            If dialogResult = dialogResult.Yes Then
                Me.Close()
                welcomepage.Show()


            End If
        End Sub

        Private Sub TxtName_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TxtName.KeyPress

            Dim ch As Char = e.KeyChar

            If Char.IsDigit(ch) Then    'restricting txtUname to input only characters
                e.Handled = True

            End If
        End Sub

        Private Sub registration_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        End Sub

        Private Sub TxtPhone_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TxtPhone.KeyPress

            Dim ch As Char = e.KeyChar

            If Char.IsLetter(ch) Then   'restricting txtphone to input only digit
                e.Handled = True
            End If
        End Sub

        Private Sub BttnSbmit_Click(sender As System.Object, e As System.EventArgs) Handles BttnSbmit.Click
            Dim conn As New OleDbConnection("provider=microsoft.jet.OleDB.4.0;Data Source=D:\fnal projek\khurasan.mdb; Persist Security Info = false;")
            Dim sql As String = String.Empty



            Dim Fon As String = Val(TxtPhone.Text)
            Dim IC As String = Val(TxtICNum.Text)
            Dim email As New Regex("^([\w\-]+\.)*[\w\-]+@([\w\-]+\.)+([\w\-]{2,3})$")


            If TxtICNum.Text = "" Then
                MsgBox("Please enter the IC number", MsgBoxStyle.Critical, "Khurasan Online")
            ElseIf TxtUname.Text & TxtICNum.Text & Rtxtadd.Text & TxtPwd.Text & TxtName.Text & TxtMail.Text & TxtRemail.Text = "" Then

                MsgBox("Please fill all the empty field", MsgBoxStyle.Critical, "Khurasan Online")

            ElseIf email.IsMatch(TxtMail.Text) = False Then
                MsgBox("Please insert correct email address", MsgBoxStyle.Critical, "Khurasan Online")

            ElseIf Fon.Length < 9 Or Fon.Length > 9 Then

                MsgBox("Please enter the correct Phone number", MsgBoxStyle.Critical, "Khurasan Online")

            ElseIf IC.Length < 12 Or IC.Length > 12 Then

                MsgBox("Please enter the correct IC number", MsgBoxStyle.Critical, "Khurasan Online")
            Else

                If _Userid = 0 Then
                    sql = "insert into Customer(Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum)" & "values ('" & TxtUname.Text & "', '" & TxtPwd.Text & "','" & TxtName.Text & "','" & TxtICNum.Text & "','" & cmboxGndr.Text & "', '" & TxtMail.Text & "','" & Rtxtadd.Text & "','" & TxtPhone.Text & "' ) "
                Else
                    sql = "update Customer Username = '" & TxtUname.Text & "', Password = ' " & TxtPwd.Text & " ', Name = ' " & TxtName.Text & " ', NumIC = ' " & TxtICNum.Text & " ', Gender = ' " & cmboxGndr.Text & " ', Email = ' " & TxtMail.Text & " ', Address = ' " & Rtxtadd.Text & " ', PhoneNum = '" & TxtPhone.Text & "' Where Userid =" & _Userid


                End If

                Try
                    conn.Open()

                    Dim Command As New OleDbCommand(sql, conn)
                    Command.ExecuteNonQuery()


                    MsgBox("Success !!!", MsgBoxStyle.Information, "Khurasan Online")
                Catch ex As Exception
                    MsgBox("You can only register once !!!", MsgBoxStyle.Exclamation, "Khurasan Online")
                End Try

                conn.Close()


            End If
        End Sub
    End Class

Recommended Answers

All 32 Replies

First thing I would do, is when you catching the exception (Catch ex As Exception), you are not displaying the exception. Another thing I see is where you are validating the data and displaying the error. You should exit the method when the validation fails. This way you don't try to save invalid data. This may be where your problem lies.

 If TxtICNum.Text = "" Then100. 
        MsgBox("Please enter the IC number", MsgBoxStyle.Critical, "Khurasan Online")

        ' Insert This
        Exit Sub
    Else If

Since you are not exiting the method, the entire method is still being executed. so the following is still happening:

conn.Open()
Dim Command As New OleDbCommand(sql, conn)
Command.ExecuteNonQuery()

Place the Exit Sub after each validation. This should solve the problem. Also, until the assigment is turned in, place another MsgBox(ex.toString) call in the Catch Ex as Exception statement so you can see where the error lies.

error16 now i know what is the error well not actually now huhuh... i have attach the error...would you help me...btw i have done what u have told me..i think the error is insert my data to the db..but i actually don't know exactly what the error is...please2.....help me...
line 137 is this >>>> Command.ExecuteNonQuery()

sql = "insert into Customer(Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum)" & "values ('" & TxtUname.Text & "', '" & TxtPwd.Text & "','" & TxtName.Text & "','" & TxtICNum.Text & "','" & cmboxGndr.Text & "', '" & TxtMail.Text & "','" & Rtxtadd.Text & "','" & TxtPhone.Text & "' ) "

Change your Insert statement to -

sql = "INSERT INTO Customer(Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum) VALUES ('" & TxtUname.Text & "', '" & TxtPwd.Text & "', '" & TxtName.Text & "', '" & TxtICNum.Text & "', '" & cmboxGndr.Text & "', '" & TxtMail.Text & "', '" & Rtxtadd.Text & "', '" & TxtPhone.Text & "')"

''Note that if txtICNum is ONLY an integer (number), you must NOT include the ' ' hyphen sign...

I have also asked the mods to move this to .NET, this is VB4,5,6 ... :)

HI andre Ret i have change insert into to a capital letter and also the values...it still show the same errror...in my db the ic num n phone num is in text...should i hange it to num and remove the ' ' ...

linabeb. to find error use debugger , just place a break point then use f11 to check each line of code to find where is the error. this will help you in future , now to get the proper error you can use try catch , like this

try
'your code here
catch
msgbox(err.description)
end try

this will help you to get description of your error .
and a better way to write code is that every one can understand it . you can use insert can update commands as follows

dim con as new sqlconnection ("your string")
dim cmd as new sqlcommand
con.open()
cmd.connection = con
cmd.commandtext = "insert into Customer (Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum) values (@Username, @Password, @Name, @NumIC, @Gender, @Email, @Address, @PhoneNum)"
cmd.paramerters.addwithvalue("@Username",txtusername.text)
cmd.paramerters.addwithvalue("@Password",txtPassword.text)
cmd.paramerters.addwithvalue("@Name",txtName.text)
cmd.paramerters.addwithvalue("@NumIC",txtNumIc.text)
cmd.paramerters.addwithvalue("@Gender",txtGender.text)
cmd.paramerters.addwithvalue("@Email",txtEmail.text)
cmd.paramerters.addwithvalue("@Address",txtAddress.text)
cmd.paramerters.addwithvalue("@PhoneNum",txtPhoneNo.text)
cmd.executenonquery()
con.close

'and here is a query for update 

dim con as new sqlconnection ("your string")
dim cmd as new sqlcommand
con.open()
cmd.connection = con
cmd.commandtext = "update Customer set  Username=@Username, Password=@Password, Name=@Name, NumIC=@NumIC, Gender=@Gender, Email=@Email, Address=@Address, PhoneNum=@PhoneNum"
cmd.paramerters.addwithvalue("@Username",txtusername.text)
cmd.paramerters.addwithvalue("@Password",txtPassword.text)
cmd.paramerters.addwithvalue("@Name",txtName.text)
cmd.paramerters.addwithvalue("@NumIC",txtNumIc.text)
cmd.paramerters.addwithvalue("@Gender",txtGender.text)
cmd.paramerters.addwithvalue("@Email",txtEmail.text)
cmd.paramerters.addwithvalue("@Address",txtAddress.text)
cmd.paramerters.addwithvalue("@PhoneNum",txtPhoneNo.text)
cmd.executenonquery()
con.close

i am not saying that you are doing wrong but these things will help you in you future.
i just type all this here to may be there is some spell mistakes , please check them and also use try catch and then tell me the msgbox so that i can better understand the prob , as there is not much time to check all your code.

Regards

i dont get it..huhuhuhu...ermm i just want to know im using acces for my db n im using the insert statement..its that ok..and mr waqas..ermm..that insert n update can be use also ?? so i can choose either one of it..ohh im losttt....hohohohohoho

try
'your code here (what should mycode will be)
catch
msgbox(err.description)
end try

what should i put my code????

linabeb. try catch block is used to handle exceptions , you can put any code inside try catch if there will be any error in your code it will give you msg about it .and if there is no error then it will execute your code normally.
now just simple change this

 Try

   If _Userid = 0 Then
conn.open()
 dim cmd as new OleDbCommand()
cmd.connection = conn
cmd.commandtext = "insert into Customer (Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum) values (@Username, @Password, @Name, @NumIC, @Gender, @Email, @Address, @PhoneNum)"
cmd.paramerters.addwithvalue("@Username",txtusername.text)
cmd.paramerters.addwithvalue("@Password",txtPassword.text)
cmd.paramerters.addwithvalue("@Name",txtName.text)
cmd.paramerters.addwithvalue("@NumIC",txtNumIc.text)
cmd.paramerters.addwithvalue("@Gender",txtGender.text)
cmd.paramerters.addwithvalue("@Email",txtEmail.text)
cmd.paramerters.addwithvalue("@Address",txtAddress.text)
cmd.paramerters.addwithvalue("@PhoneNum",txtPhoneNo.text)
cmd.executenonquery()
con.close

                Else

    dim cmd as new OleDbCommand()
    conn.open()
    cmd.connection = conn
    cmd.commandtext = "update Customer set  Username=@Username, Password=@Password, Name=@Name, NumIC=@NumIC, Gender=@Gender, Email=@Email, Address=@Address, PhoneNum=@PhoneNum"
    cmd.paramerters.addwithvalue("@Username",txtusername.text)
    cmd.paramerters.addwithvalue("@Password",txtPassword.text)
    cmd.paramerters.addwithvalue("@Name",txtName.text)
    cmd.paramerters.addwithvalue("@NumIC",txtNumIc.text)
    cmd.paramerters.addwithvalue("@Gender",txtGender.text)
    cmd.paramerters.addwithvalue("@Email",txtEmail.text)
    cmd.paramerters.addwithvalue("@Address",txtAddress.text)
    cmd.paramerters.addwithvalue("@PhoneNum",txtPhoneNo.text)
    cmd.executenonquery()
    con.close



                End If


                    MsgBox("Success !!!", MsgBoxStyle.Information, "Khurasan Online")
                Catch ex As Exception
                    MsgBox("You can only register once !!!", MsgBoxStyle.Exclamation, "Khurasan Online")
                End Try




            End If

i've changed it and its still show the msg you can only register once...and still point at this line >>>> Cmd.ExecuteNonQuery()

huuhuhu...i dont know y???

I see you are declareing the SQL string. In the catch block

Catch ex As Exception
MsgBox("You can only register once !!!", MsgBoxStyle.Exclamation, "Khurasan Online")
End Try

Place a msgbox to display your sql variable. Here you can see what is sent to the database. There may be a field that is not filled.

Also the SQL statement:

sql = "insert into Customer(Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum)" & "values ('" & TxtUname.Text & "', '" & TxtPwd.Text & "','" & TxtName.Text & "','" & TxtICNum.Text & "','" & cmboxGndr.Text & "', '" & TxtMail.Text & "','" & Rtxtadd.Text & "','" & TxtPhone.Text & "' ) "

I see there is no space after Customer in INSERT INTO Customer. This may be the error.

maligui..huhuhuhuu...still the same

What is the sql variable after it is filled? You can also use Console.WriteLine(sql) and look in the output window.

??? how to do that...

Dim Command As New OleDbCommand(sql, conn)   

Try
    conn.Open()  
    Command.ExecuteNonQuery()    

    MsgBox("Success !!!", MsgBoxStyle.Information, "Khurasan Online")
Catch ex As Exception
    ' Print out the sql statement.
    Console.WriteLine("SQL Statement:{0}", sql)

    ' print out the parameters
     For Each p As OleDb.OleDbParameter In Command.Parameters
         Console.WriteLine("Name:{0} Value{1}", p.ParameterName, p.Value.ToString)
     Next

    MsgBox("You can only register once !!!", MsgBoxStyle.Exclamation, "Khurasan Online")
End Try

it shows the same line error... >>> cmd.ExecuteNonQuery()
error in insert into..........

Look in the Output Window:

View->Other Windows->Output Window

It should be in the panel under your code viewer. In the Output window, it should have something like:

SQL Statement: <Your sql statement>
<A list of paramenters>

the <> are placeholders for what will actually be there.

hi linabeb did you got it already?

I have reporduced the issue. This is the corrected statement.

 If _Userid = 0 Then
     sql = "insert into Customer(Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum)" & " values ('" & txtUName.Text & "', '" & txtPwd.Text & "','" & txtName.Text & "','" & TxtICNum.Text & "','" & cmboxGndr.Text & "', '" & txtMail.Text & "','" & Rtxtadd.Text & "','" & txtPhone.Text & "' ) "
     Else

There was no space before values in the insert sql statement.

Also, notice how I displayed the SQL statement in the Catch ex as Exception block? Be sure to remove this before you release it.

Try
    conn.Open()

    Dim Command As New OleDbCommand(sql, conn)
    Command.ExecuteNonQuery()


    MsgBox("Success !!!", MsgBoxStyle.Information, "Khurasan Online")
        Catch ex As Exception

        ' display error and the sql statement
        ' delete this line after you have debugged!
        MsgBox(ex.ToString & vbCrLf & sql)


        MsgBox("You can only register once !!!", MsgBoxStyle.Exclamation, "Khurasan Online")
End Try

my output is blank...
and i have change as what maligui said...and new error have come out..i have attach that error... error21

my output is blank..there is no sql statement??.
and i have change as what maligui said...and new error have come out..i have attach that error... error22

it still have error...a new error

i have rearranged all the code again...and it back to thep first error...on this line

cmd.ExecuteNonquery()

it says that OleDbException was unhandled syntax error at insert into...ermm...

please post your full code here of submit button .

below is my full code for submit button..

Private Sub BttnSbmit_Click(sender As System.Object, e As System.EventArgs) Handles BttnSbmit.Click

        Dim conn As New OleDbConnection("provider=microsoft.jet.OleDB.4.0;Data Source=D:\fnal projek\khurasan.mdb; Persist Security Info = false;")
        Dim sql As String = String.Empty



        Dim Fon As String = Val(TxtPhone.Text)
        Dim IC As String = Val(TxtICNum.Text)
        ' Dim email As New Regex("^([\w\-]+\.)*[\w\-]+@([\w\-]+\.)+([\w\-]{2,3})$")


        If TxtICNum.Text = "" Then
            MsgBox("Please enter the IC number", MsgBoxStyle.Critical, "Khurasan Online")
            Exit Sub

        ElseIf TxtUname.Text & TxtICNum.Text & Rtxtadd.Text & TxtPwd.Text & TxtName.Text & TxtMail.Text & TxtRemail.Text = "" Then

            MsgBox("Please fill all the empty field", MsgBoxStyle.Critical, "Khurasan Online")

            Exit Sub
            ' ElseIf email.IsMatch(TxtMail.Text) = False Then
            '    MsgBox("Please insert correct email address", MsgBoxStyle.Critical, "Khurasan Online")

        ElseIf Fon.Length < 9 Or Fon.Length > 9 Then

            MsgBox("Please enter the correct Phone number", MsgBoxStyle.Critical, "Khurasan Online")
            Exit Sub

        ElseIf IC.Length < 12 Or IC.Length > 12 Then

            MsgBox("Please enter the correct IC number", MsgBoxStyle.Critical, "Khurasan Online")

            Exit Sub
        Else

            If _Userid = 0 Then
                sql = "INSERT INTO Customer(Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum)" & "VALUES ('" & TxtUname.Text & "', '" & TxtPwd.Text & "','" & TxtName.Text & "'," & TxtICNum.Text & ",'" & cmboxGndr.Text & "', '" & TxtMail.Text & "','" & Rtxtadd.Text & "'," & TxtPhone.Text & " ) "
            Else
                sql = "UPDATE Customer Username = '" & TxtUname.Text & "', Password = ' " & TxtPwd.Text & " ', Name = ' " & TxtName.Text & " ', NumIC =  " & TxtICNum.Text & " , Gender = ' " & cmboxGndr.Text & " ', Email = ' " & TxtMail.Text & " ', Address = ' " & Rtxtadd.Text & " ', PhoneNum = " & TxtPhone.Text & " Where Userid =" & _Userid


            End If

            Try
                conn.Open()

                Dim Command As New OleDbCommand(sql, conn)
                Command.ExecuteNonQuery()


                MsgBox("Success !!!", MsgBoxStyle.Information, "Khurasan Online")

            Catch ex As Exception

                MsgBox(ex.ToString & vbCrLf & sql)

                MsgBox("You can only register once !!!", MsgBoxStyle.Exclamation, "Khurasan Online")

            End Try

            conn.Close()



        End If
    End Sub

now it says that data type mismatch huhhu..
i would like to ask...if my numIC & PhoneNum is in number in my access(db) then i must remove hyphen sign right ... and should i assign format(as in general number,currency....) in access..for now my numic @ phonenum is only a number without any format...should i assign them in the format of general number??

I am still not seeing a space between "... PhoneNum)" & "VALUES". It should be "... PhoneNum) VALUES " & ... Just make it all one string all the way to values. Like so:

sql = "INSERT INTO Customer(Username, Password, Name, NumIC, Gender, Email, Address, PhoneNum) VALUES ('" & TxtUname.Text & "', '" & TxtPwd.Text & "', '" & TxtName.Text & "', " & TxtICNum.Text & ", '" & cmboxGndr.Text & "', '" & TxtMail.Text & "', '" & Rtxtadd.Text & "', " & TxtPhone.Text & ")"

If you phone numbers are a number in access, then all non-numerical data must be filtered out. A number is an integer, long, etc..), so it can only contain numbers and a decimal. I would use a string type, and use a format of PhoneNumber. Or you can just just leave the format blank. After all, the app is your front end, so all your data is actually seen in the app.

this is my recent code for submit button.... its still show error...datatype mismatch... huhuu...

Private Sub BttnSbmit_Click(sender As System.Object, e As System.EventArgs) Handles BttnSbmit.Click

        Dim conn As New OleDbConnection("provider=microsoft.jet.OleDB.4.0;Data Source=D:\fnal projek\khurasan.mdb; Persist Security Info = false;")
        Dim sql As String = String.Empty



        Dim Fon As String = Val(TxtPhone.Text)
        Dim IC As String = Val(TxtICNum.Text)
        ' Dim email As New Regex("^([\w\-]+\.)*[\w\-]+@([\w\-]+\.)+([\w\-]{2,3})$")


        If TxtICNum.Text = "" Then
            MsgBox("Please enter the IC number", MsgBoxStyle.Critical, "Khurasan Online")
            Exit Sub

        ElseIf TxtUname.Text & TxtICNum.Text & Rtxtadd.Text & TxtPwd.Text & TxtName.Text & TxtMail.Text & TxtRemail.Text = "" Then

            MsgBox("Please fill all the empty field", MsgBoxStyle.Critical, "Khurasan Online")

            Exit Sub
            ' ElseIf email.IsMatch(TxtMail.Text) = False Then
            '    MsgBox("Please insert correct email address", MsgBoxStyle.Critical, "Khurasan Online")

        ElseIf Fon.Length < 9 Or Fon.Length > 9 Then

            MsgBox("Please enter the correct Phone number", MsgBoxStyle.Critical, "Khurasan Online")
            Exit Sub

        ElseIf IC.Length < 12 Or IC.Length > 12 Then

            MsgBox("Please enter the correct IC number", MsgBoxStyle.Critical, "Khurasan Online")

            Exit Sub
        Else

            If _Userid = 0 Then
                sql = "INSERT INTO Customer([Username], [Password], [Name], [NumIC], [Gender], [Email], [Address], [PhoneNum]) VALUES ('" & TxtUname.Text & "', '" & TxtPwd.Text & "','" & TxtName.Text & "'," & TxtICNum.Text & ",'" & cmboxGndr.Text & "', '" & TxtMail.Text & "','" & Rtxtadd.Text & "'," & TxtPhone.Text & " ) "
            Else
                sql = "UPDATE Customer Username = '" & TxtUname.Text & "', Password = ' " & TxtPwd.Text & " ', Name = ' " & TxtName.Text & " ', NumIC =  " & TxtICNum.Text & " , Gender = ' " & cmboxGndr.Text & " ', Email = ' " & TxtMail.Text & " ', Address = ' " & Rtxtadd.Text & " ', PhoneNum = " & TxtPhone.Text & " Where Userid =" & _Userid


            End If

            Try
                conn.Open()

                Dim Command As New OleDbCommand(sql, conn)
                Command.ExecuteNonQuery()


                MsgBox("Success !!!", MsgBoxStyle.Information, "Khurasan Online")

            Catch ex As Exception

                MsgBox(ex.ToString & vbCrLf & sql)

                MsgBox("You can only register once !!!", MsgBoxStyle.Exclamation, "Khurasan Online")

            End Try

            conn.Close()



        End If
    End Sub

sql = "INSERT INTO Customer([Username], [Password], [Name], [NumIC], [Gender], [Email], [Address], [PhoneNum]) VALUES ('" & TxtUname.Text & "', '" & TxtPwd.Text & "','" & TxtName.Text & "'," & TxtICNum.Text & ",'" & cmboxGndr.Text & "', '" & TxtMail.Text & "','" & Rtxtadd.Text & "'," & TxtPhone.Text & " ) "

Has some errors. Replace with:

sql = "INSERT INTO Customer([Username], [Password], [Name], [NumIC], [Gender], [Email], [Address], [PhoneNum]) VALUES ('" & TxtUname.Text & "', '" & TxtPwd.Text & "', '" & TxtName.Text & "', '" & TxtICNum.Text & "', '" & cmboxGndr.Text & "', '" & TxtMail.Text & "', '" & Rtxtadd.Text & "', '" & TxtPhone.Text & "' ) "

I'm sure that you an enter numbers in single quotes. I am assuming NUMIC and PhoneNUM are numbers.

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.