Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Updating Field (determined By Variable) On A Second Form

Discussion in 'Information Technology' started by Hindsey, Jul 28, 2006.

  1. Hindsey

    Expand Collapse

    Here's my situation: I have a form that has several combo boxes that a user
    selects a "code" for different things. These codes are stored in different
    tables, for each combo box. Some times there are many codes, and a combo box
    is not a practical way to lookup what they are looking for.

    So, I create a form that if a user double clicks on the combo box, it runs a
    public procedure "SetLookupCodes" that opens up this lookup form and creats a
    recordset based upon the table for the codes that I want to be able to
    search. I pass 2 variables into the procedure. The first "fField" is the name
    of the field that I double-clicked, and the second is the table that stores
    the codes for this particular field "fCode."

    My form comes up great and I can see the right table and search on it fine.
    But now, I want to be able to double-click the Code field on this second form
    and update the field (whose name was passed into the procedure on the
    double-click of the first form). I can't seem to figure out the right way to
    code it so that it looks at the text of the variable to determine the field
    to update. I pass the field name's value into a Public variable strLookup.
    The code I've tried is:

    Private Sub Code_DblClick(Cancel As Integer)

    Dim FirstMainForm As Form
    Dim UpdateField As Field
    Set FirstMainForm = Forms!frmIncidentReport
    Set UpdateField = strLookup

    FirstMainForm.UpdateField = Me!
    End Sub
    Where am I going wrong?
  2. Loading...

Since you're here... we have a small favor to ask...     Become a Supporter      ::     Make a Contribution     

Share This Page