ACCESS - 255

Access (in Design view) allows only 255 max for each field size. What if I use Insert statement and the user input more than that? Is there a way to allow them to input beyond  255 char?
VBdotnet2005Asked:
Who is Participating?
 
SanclerConnect With a Mentor Commented:
If the Access field - accurint - to which Me.txtSave.Text is being sent is a Memo field that code should work.  The bit about OleDbType.VarWChar, with a size of 0 was for if you were doing your insert with parameters as you would, for example, with a dataadapter.  You can ignore it.

Roger

0
 
SanclerCommented:
You will only be able to do this if the Access field type is Memo, rather than Text.  For the parameter datatype in the insert command use OleDbType.VarWChar, with a size of 0.  Then the only limit will be any that is placed on user input by the control in which that happens.

Roger
0
 
VBdotnet2005Author Commented:
Dim ConnectionString As String = "provider=microsoft.jet.oledb.4.0;" + "data source =  C:\Documents and Settings\MAX.MCCI_DOM\Desktop\MAX\bad.mdb"
        Dim Command As OleDbCommand


        Try
            'Dim Connection As OleDbConnection = New OleDbConnection(ConnectionString)
            Dim Connection As New OleDbConnection(ConnectionString)

            Connection.Open()

            Command = New OleDbCommand("insert into BadTable(Address, CityState, accurint ) values ('" & Me.txtAddress.Text & "' , '" & Me.txtCity.Text & "', '" & Me.txtSave.Text & "')", Connection)

            Command.ExecuteNonQuery()

            Connection.Close()


        Catch ex As OleDbException

            MsgBox(ex.ToString)


        End Try
    End Sub
0
 
SanclerCommented:
What's that supposed to mean?
0
 
VBdotnet2005Author Commented:
Above is btnAdd -  Me.txtSave.Text   is the only one I am questioning really. I want this filed to be able to contain more than 255 charactor. I don't understand this part  -
  For the parameter datatype in the insert command use OleDbType.VarWChar, with a size of 0. --- I thought I put this comment above my code.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.