Results 1 to 8 of 8
  1. #1
    mejia.j88 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228

    Question autofill box is always updated as 0.

    like many here, im new to access, and i have set up a form that auto-populates two fields.



    the "part number" combo box shows three things, Part number, Stack size, and Cut size.

    upon choosing the part number, stack size and cut size should be automatically filled.

    Stack size works great, although, cut size always has the value 0, regardless of what should be there.

    below is the code im using:

    Private Sub txtpart_number_afterupdate()
    Me.txtStack_Size = Me.txtPart_Number.Column(1) + 2
    Me.txtCut_Size = Me.txtPart_Number.Column(2)
    End Sub

    help please, i don't know why this is happening.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Does the part number combo row source include that field? Is the column count property of the combo appropriate to the number of fields in the row source (in this case it needs to be 3)?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    mejia.j88 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228
    The row source for the combo box is a query i created from a table containing the Part Number, the Stack Size, and the Cut Size.

    My column count is set to 3; and the table with the part number comes from a different db. it's linked to the one im working on now.
    :X

    another note: on my code, if i change the line

    Me.txtCut_Size = Me.txtPart_Number.Column(2)

    to:

    Me.txtCut_Size = Me.txtPart_Number.Column(1)

    the 0 value goes away, and it is replaced by a number from the column im calling.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What type of value is cut size? If it's a decimal, it may be rounding to zero if you put it in a field expecting an integer. Can you post the db here, or a representative sample?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    mejia.j88 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228
    Cut size is a decimal; i have the field to receive general numbers with 4 decimals on display.

    unfortunately I am required full disclosure with our information, hence I cannot post the db or a representative sample.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    What is the data type of the field you're putting the value into? The format doesn't matter if the data type is wrong.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    mejia.j88 is offline Competent Performer
    Windows 7 32bit Access 2007
    Join Date
    Nov 2011
    Location
    california
    Posts
    228
    i changed the data type from number to text and it's working now, even though all of the data from the query are numbers.
    strange?

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I suspect the field size was integer or long integer, which could have caused the problem. You might try currency, double or single depending on your needs. Be forewarned that single and double are floating point, and can have issues. For instance .25 could get stored as .2499999.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. records with different updated report_date
    By lizzywu in forum Reports
    Replies: 3
    Last Post: 10-27-2011, 01:28 PM
  2. Append only updated records
    By Fabdav in forum Queries
    Replies: 4
    Last Post: 10-10-2011, 11:17 AM
  3. Deleting values after a field is updated
    By mwhcrew in forum Forms
    Replies: 3
    Last Post: 08-16-2010, 02:52 AM
  4. the last updated date and time
    By venu in forum Access
    Replies: 2
    Last Post: 04-02-2010, 08:11 AM
  5. macro to updated tables
    By Wrangler in forum Import/Export Data
    Replies: 1
    Last Post: 01-18-2006, 11:01 PM

Tags for this Thread

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