Results 1 to 2 of 2

Need Help with Access vb coding

  1. #1
    Entrimo is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2012

    Need Help with Access vb coding

    Hey guys,

    I have a combo box which is lists all my Products from another table, "Products", it just lists the names but i want it to when i select one, to take the value "weight" from that one record and put the weight in my textbox beside the product name, i need this as it will help calculate freight and etc..

    this is a general idea of what ive been trying so far, ive tried using queries, reports... i just cant get it...

    here is the code im trying..

    Combo874 being where product names are listed and Text1144 being where i want the weight to go. the weight from prooducts form is just a number no kgs or tonne after it

    Private Sub Combo874_AfterUpdate()
    Dim p1 As String 'p1 as i have 4 product boxes and hence w1
    Dim w1 As Integer

    Me.Text = p1
    Query Form_Products.[Product Name].Value
    If Form_Products.[Product Name].Value = p1 Then
    Query Form_Products.Weight = w1
    Text1144.Value = w1
    End If

    End Sub

    Please guys you help would be much appreciated!! Thanks!!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    8300' in the Colorado Rocky Mountains
    The weight field could be included in the RowSource of the Combo874 cbo and need not be visible. Then the AfterUpdate event would just be:
    Private Sub Combo874_AfterUpdate()
       Me.Text1144 = Me.Combo874.Column(1)
    End Sub
    The Column() value is zero base4d so 1 would be the 2nd column
    (RG for short) aka Allan Bunch Previous MS Access MVP - WinXP Pro, Win7 Pro Win10 Pro - acXP, ac07, ac10, ac13
    How to mark the thread as Solved!
    Teaching is not filling a bucket but lighting a fire.
    Borrowed quote..."Docendo discimus"

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

Similar Threads

  1. Access without coding
    By kp123 in forum Access
    Replies: 4
    Last Post: 11-25-2011, 02:50 PM
  2. Access to Excel (2003 version) VBA coding help
    By iamstupid in forum Programming
    Replies: 1
    Last Post: 05-26-2011, 08:53 AM
  3. VB coding to show current date n time in access form
    By cwwaicw311 in forum Programming
    Replies: 6
    Last Post: 02-10-2010, 08:53 PM
  4. Bar-Coding
    By texasprincess7 in forum Access
    Replies: 1
    Last Post: 02-12-2009, 09:29 AM
  5. parsing data in access (coding?)
    By banker247 in forum Programming
    Replies: 0
    Last Post: 01-13-2009, 11:05 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
Tech Forums: Microsoft Office Forums