Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     

Share This Page