• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 188
  • Last Modified:

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?
0
VBdotnet2005
Asked:
VBdotnet2005
  • 3
  • 2
1 Solution
 
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
 
SanclerCommented:
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

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now