Results 1 to 10 of 10
  1. #1
    Stephanie53 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    246

    need to add another txt box..

    In one of my forms I just found out that I needed to add another column in one of my tables and I added it to my query ...now in the query i had to make sure that it was part of the caculated columns in this format


    Examples Columns:
    (NEW)
    PrimaryID | Type | Discription | Qty | UnitCost | Length | ExtCost | NetWght | TotWght

    I have it in Query to caculate like this...

    ExtCost: [Qty]*[UnitCost]*[Length] but it wont caculate past the first 2 listed in caculation.

    I had to change my VBA Code for the autofill in accross the row..but when it reaches Length it wont go any further. I changed the following VBA Code from this which was working:

    Private Sub cboPrimaryID_Change()
    Me.Type = Me.cboPrimaryID.Column(2)
    Me.Discription = Me.cboPrimaryID.Column(3)
    Me.Qty = Me.cboPrimaryID.Column(4)
    Me.UnitCost = Me.cboPrimaryID.Column(5)
    Me.NetWght = Me.cboPrimaryID.Column(7)

    End Sub

    To This...Now not working:


    Private Sub cboPrimaryID_Change()
    Me.Type = Me.cboPrimaryID.Column(2)
    Me.Discription = Me.cboPrimaryID.Column(3)
    Me.Qty = Me.cboPrimaryID.Column(4)
    Me.UnitCost = Me.cboPrimaryID.Column(5)
    Me.Length = Me.cboPrimaryID.Column(6)


    Me.NetWght = Me.cboPrimaryID.Column(8)

    End Sub

    Please assist anyway possible

    TIA

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Why doesn't it work, what happens - error message, wrong results, nothing?

    Did you change other combobox properties - ColumnCount, ColumnWidths?

    Column() index starts with 0 so if Type is in the second column its index is 1. Your index references appear to be off by 1.
    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
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Also, be aware of reserved words.... major headaches. "Type" is a reserved word in Access; see http://allenbrowne.com/AppIssueBadWord.html
    You should get in the habit of using a naming convention.

    If you open the query, is the [ExtCost] displayed correctly?

    Did you change the combo box query to include the Length field?? (a common mistake when I am doing modifications)
    Would you post the SQL of the query and the combo box??

  4. #4
    Stephanie53 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    246
    ExtCost: [Qty]*[UnitCost]*[Length] is from the Query..

    I didnt change the combo box count or anything like that

    Since you have my DB take a look at this...I know you said that it starts out with 0 and so forth...but if i follow that proceedure then I dont get anything to populate in those fields at all

  5. #5
    Stephanie53 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    246
    oh and the NetWght is populating in the Length Field now..I tried changing the Column() to going up 1 or 2 and it doesnt change...ughhh

  6. #6
    Stephanie53 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    246
    I got it!! I changed the Combobox ColumnCount & ColumnWidths. Now I have a question...I kept hitting Tab to get to the next column and it kept entering that line and clearing it out to enter in another hose. How can I fix this that they can Tab thru the columns and click on Enter to clear and start another?

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Did you also fix the Column() index references?

    Do you want to prevent enter and clear? Sounds like is moving to a new record after tab from last control. If you want to prevent moving to new record, look at the form Cycle property.
    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.

  8. #8
    Stephanie53 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    246
    I entered a number in Qty and wanted to Tab over to Length and the Tab functioned as Enter and cleared the form before I could put in the length of hose. I found out from the staff they are more likely to use the Tab between fields then Enter. So how can i prevent Tab from acting like Enter and use it as it should between fields. And use Enter as it should function by it entering the order after they are done making the selections

    As for the Column() index references I didnt need to. It accepted as it was from when I changed the it under Properties of the Combobox

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Qty must have TabOrder property set as the last control in order. Since Length was a new textbox would have thought it had the last order number. Maybe you need to change TabOrder property of controls. Form will move to new record from the last control in order unless the form Cycle property is set to Current.

    Options for managing the enter key appear to be:

    1. Data controls have a EnterKeyBehavior property. Options are Default or NewLineInField.

    2. Access Options > Advanced has settings for Enter key behavior. However, this is an application, not project, setting and will affect all forms and all databases opened. Might be able to set this application property in an AutoExec macro or in code behind a form. Then maybe want to set the property back when form or project closes.

    3. Capture the keystroke with the form KeyPress event. This event would fire with every single key stroke. And if the event detects the Enter key code then the stroke can be ignored.

    Google: Access VBA disable enter key
    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.

  10. #10
    Stephanie53 is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    246
    Ok now its working with the changes you just told to me to do. I do appriciate all the time and effort you have put in this with me and your patience too :-))

    Thank you so much and KUDOS to you!!

    Stephanie

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

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