1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: automatic filling of fields

Discussion in 'Business Applications' started by bob12, Jan 6, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. bob12

    bob12 Thread Starter

    Joined:
    Jan 6, 2012
    Messages:
    153
    I have a form with three combos and a subform with the following fields:
    Step, dataprogramada, and datareprogramada datarealizada. The field step has a list box with 15 steps. I'm trying to include a new record 7 of these 15 steps to populate. Can anyone help me?
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    bob12, welcome to the forum.
    I am not clear from your description what you are trying to do. Can you explain it a bit more and maybe provide an example.
     
  3. bob12

    bob12 Thread Starter

    Joined:
    Jan 6, 2012
    Messages:
    153
    OBP, thanks for replying.
    I will elaborate on.
    I have a form with three combos (analyst, company and product) that I can insert records, filter the combos together.
    When I insert a new product, my subform does not show any records (perfect for it is a new product).
    My subform contains the following fields: step, scheduled, rescheduled date and date performed. In the field step has a list box with 15 different types of steps to select and fill the field. I'm trying to record that a new product, 7 of these 15 steps fill automatically.
    Step repogramada scheduled date data held
    Step 1
    Step2
    step 3
    step 4
    step 5
    step 6
    step 7
    I am sending herewith the db. When you open the form, make combos in this sequence:
    Carlos, test, software10. 7 Steps will show completed, I entered manually.
    I'm trying these steps appear automatically when you insert a new product.
     

    Attached Files:

  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Sorry I can't open Access 2007/2010 databases.
    Are the steps individual fields or a List box?
    Perhaps a a Screenprint of the Form would help.
     
  5. bob12

    bob12 Thread Starter

    Joined:
    Jan 6, 2012
    Messages:
    153
    What is your version of Access? Can I convert.
    I am sending herewith some images to try to explain better.
     

    Attached Files:

  6. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    My access version is 2003, some 2007 features may stop you converting the form.

    In the view that you show, it looks like you have selected the 1st seven items from the Passo Combo for the 1st seven Records, is that correct?
     
  7. bob12

    bob12 Thread Starter

    Joined:
    Jan 6, 2012
    Messages:
    153
    Just selected the first seven. Only I did it manually. How do I get when entering a new product, the same seven steps show automatically?
     
  8. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    The only way to do this is with VBA code, basically you open the table using a VBA Recordset and enter each record using VBA code. Then refresh the Subform to see the new values.
    To do so I would need to know the exact names of the tables and fields involved, especially the field that links the tables.
     
  9. bob12

    bob12 Thread Starter

    Joined:
    Jan 6, 2012
    Messages:
    153
    I'm sending a picture with the relationship. Only does it help?
     

    Attached Files:

  10. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    That is good, am I correct in assuming that the tblauxiliarPassos is the table for the Combo "Passo"?
    If so we can use that to get the first 7 Passo names and I can provide you with some VBA code to test that part first.
     
  11. bob12

    bob12 Thread Starter

    Joined:
    Jan 6, 2012
    Messages:
    153
    Perfect, the auxiliary table steps, I used to fill the steps. In the field while the table status while research assistant used the "pull" the steps of the auxiliary table steps.
     
  12. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    OK, this code will need to go in the Mainform's On Current Event Procedure.
    Do you know how to enter data in an event procedure?
     
  13. bob12

    bob12 Thread Starter

    Joined:
    Jan 6, 2012
    Messages:
    153
    Yes, I know. Just do not know what code to insert.
     
  14. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Ok, we will try this first. Here is the code, when there is a new mainform record it should display in a message box the code and name of each of the first 7 NomeDoPasso in the "TblAuxiliarPassos" table.

    Dim rs As Object, recount As Integer, count As Integer, names As String, rstable As Object, codigo as integer
    On Error goto errorcatch
    Set rs = CurrentDb.OpenRecordset("TblAuxiliarPassos")
    rs.MoveFirst
    For count = 1 to 7
    codigo = rs.Codigo
    names = rs.NomeDoPasso
    msgbox "codigo= " & codigo & " NomeDoPasso = " & names
    rs.movenext
    Next count
    rs.close
    set rs = nothing
    Exit Sub
    errorcatch:
    MsgBox Err.Description


    PS I am making this up as I go along, so you may get an error message if it goes wrong.
     
  15. bob12

    bob12 Thread Starter

    Joined:
    Jan 6, 2012
    Messages:
    153
    I put the code in the event is not listed in the combo product.
    7 shows when updating mailboxes with names of steps, but do not enter any step. I'm trying to get the first 7 steps to enter after entering a new product. There is no need to show the message box. Just message when entering a new product like this before already.
    Perhaps the change of the code is simple, but do not know how. images attached.
     

    Attached Files:

  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1034935

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice