ACCESS - 255

Posted on 2006-05-09
Last Modified: 2010-04-23
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?
Question by:VBdotnet2005
    LVL 34

    Expert Comment

    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.


    Author Comment

    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

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


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



            Catch ex As OleDbException


            End Try
        End Sub
    LVL 34

    Expert Comment

    What's that supposed to mean?

    Author Comment

    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.
    LVL 34

    Accepted Solution

    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.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction When many people think of the WebBrowser ( control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
    1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now