+ Reply to Thread
Results 1 to 2 of 2

open a form and satisfy form 'if' statement

  1. #1
    Registered User
    Join Date
    07-04-2011
    Location
    baltimore
    MS-Off Ver
    Excel 2003
    Posts
    1

    open a form and satisfy form 'if' statement

    I have a form that allows me to enter an inventory item. It has an 'if' statement linked to a drop down box, which if the proper item is selected, additional data fields are populated. This works great if I am entering in a new inventory item.

    Problem Im having, is I have a link elsewhere that opens this form to a specific record based on its ID. This also works great. The only problem is that if this record has data in the hidden fields (which become visible only when the appropriate drop down box option is selected) these fields remain hidden.

    If this makes any sense.


    Here it is again in a little more detail.

    I keep an inventory of all of our machinery and equipment. When you select "Enter New Inventory Item" a form pops up. On this form is a number of fields. Some are drop down boxes. If the drop down box pertaining to Equip Type, is set to Machinery, there are 10 or 15 additional fields originaly set to "not visible" which become visible. These fields gather engine information, model #, serial #, Oil type, Filter Size, etc...

    Not all of our equipment requires storing this additional info so it is hidden untile the appropriate option is selected int the Equip Type box.

    This works great when entering new data in.

    Problem I am having is, I have a link elsewhere in my database for a record lookup, which opens the same form but sets it to the appropriate record based on the ID#. This too works good. The problem I am having is that if record I am looking up is of Machinery type, the hidden fields remain hidden. If I manually edit the form and set them to visible, the data is popluated into the appropriate field as it should be.

    So my question is, how to open this form to a specific record, and at the same time satisfy the "if" statement that either keeps the added fields hidden, or sets them to visible.


    Here is my call statement for opening form via the Item LookUp Link.



    strFrmName = "Vehicle Details"

    strWhere = "[Veh ID#] = """ & Me.[TextVehID] & """"


    DoCmd.OpenForm "Vehicle Details", , , strWhere, acFormReadOnly

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: open a form and satisfy form 'if' statement

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1