Results 1 to 9 of 9
  1. #1
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41

    Field size error

    I've searched all over for a solution and can't seem to find one.

    I have two forms, customer information and customer order. Each of these forms are generated from a query: customer information and customer order.

    On the customer information form I have a button that I would like have the user select to create a new order for that customer by automatically opening the customer order form and populating the name and id fields.

    The code behind the order button on the customer info form is:

    DoCmd.OpenForm "frmOrders", , , , , , Me.txtID & ";" & Me.txtName

    In the form load of the I have the code:

    Dim strOpenArgs() As String

    If Not IsNull(Me.OpenArgs) Then
    strOpenArgs = Split(Me.OpenArgs, ";")
    Me.txtID = strOpenArgs(0)
    Me.txtName = strOpenArgs(1)
    Else
    Msgbox "Order Does Not Exist"
    End If

    When I select the button on the order info form I get the following error message: The field is too small to accept the amount of data you attempted.

    I'm not sure why this error is occuring. The customer information form is created from a query directly generated from the customer information table. The customer order form is generated from the customer order query which is a link of the customer information table and customer order table.

    Insight would be greatly appreciated.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Maybe either:

    1. Somehow the values are picking up some extra characters. Step debug. What are the values of each array element?

    2. txtID and/or txtName not bound to the field should be
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    I've gone through by step and everything seems to be working properly. I've attached the database because maybe I'm missing something (I'm not very good with VBA).

    As far as the fields going to the right place, everything seems to be in order from what I can tell, though I'm not sure.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    The code in your project uses a : in the OpenArgs argument. So the Split was not happening.

    However, it is not necessary to include the name in this because you have the CustomerID. You can get the name on the order form by joining the customer table to order table in the form's recordsource (which you have already done). Lock the name textbox so it can't be edited on this form.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    Thank you so much for catching the ":" it really had me stumpped!


    The customer ID is passing correctly but I get and error message Field name is based on an expression and cannot be edited. I know you adivised to lock the name field but I would like to still have the name visible on the form and I'm not sure how to change to codes in the button and form to do so

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    Locking a control will still show it and its data, but cannot edit in the control. The Locked property is on the Data tab of the Properties sheet.

    As previous stated, it is not necessary to pass the name so do not include it in the OpenArgs and do not try to set the textbox with the code. Use the field from the form's RecordSource to display the name.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    Sorry if I'm being an nuisance. I'm not very good with coding at all, this is my first attempt.

    I locked the name field and eliminated it from the Openargs but the orders form is not allowing me to select a part, payment or enter any other information. Is there any reason why this is happening?

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,926
    No longer need the Spilt function. Change the code in the Load procedure.

    Change the Order form RecordSource to:
    SELECT tblCustomerOrder.*, [LastName] & ", " & [FirstName] AS Name
    FROM tblCustomerInfo RIGHT JOIN tblCustomerOrder ON tblCustomerInfo.CustomerID = tblCustomerOrder.CustomerID;

    Should also lock the CustomerID textbox so user can't accidentally change it. Set TabStop to No for CustomerID and Name.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    A million thank yous!!! This worked fabulosly!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Increase Size of Field Name
    By tonere in forum Database Design
    Replies: 5
    Last Post: 06-27-2011, 02:30 PM
  2. After error database have less size
    By Douglasrac in forum Access
    Replies: 3
    Last Post: 03-31-2011, 07:16 PM
  3. Reduce field size in query field
    By escapades_access in forum Queries
    Replies: 9
    Last Post: 03-13-2011, 12:21 PM
  4. OLE field size?
    By Wiele in forum Programming
    Replies: 2
    Last Post: 01-19-2011, 01:22 AM
  5. Field size
    By nikki in forum Database Design
    Replies: 1
    Last Post: 02-15-2010, 09:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums