Results 1 to 7 of 7
  1. #1
    CliffStir is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2018
    Posts
    2

    Adding a control to a form does not insert any VBA code in the form.

    I am running Access 2007 (accdb) on Win 7 PRO that, for the most part queries an ms SQL server.


    I use a lot of combo boxes to create dropdows to select things like Vendor ID's or PO numbers, etc. (All pretty basic / simple stuff).

    Suddenly, when I try to add a control to a form (as In design mode and add a combo box), When I choose show Visual Basic the only code on the form is the opening statement : " Option Compare Database " (my quotes)

    None of my objects or controls are actually being included or listed in the VBA code.

    Assuming I had made some sort of Database Setting change, I have reviewed the MS ACCESS OPTIONS and don't see any obvious issues.

    The "has module" property is set to yes.
    Can anyone suggest other possible issues? Point me in a direction to look?
    I have googled the question many ways and cannot find a reference to this problem anywhere. (Although there are many reference to Dissapearing code, no one else seems to be having the problem where code is not being updated to the form in the first place.)

    seeking enightenment

    CliffStir

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    adding controls does not create code.

    if you turn on the wizard, SOME controls can be added with code. Like the 'Close Form' button. The wizard will add the code.
    but manually, no code is created.

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    unless you have a corruption, most likely reason is your other controls do not have any code.

    Not clear from your thread, but if you copy a control from one form to another, it only copies the control, not any related code

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Perhaps you have used embedded macros instead of VBA code for all events until now.
    If so, they won't appear in the VBE ... and as such are a PITA
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    CliffStir is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jun 2018
    Posts
    2
    Based on the quick replies I guess I made an assumption I shouldn't have.

    I was assuming that there would be some embedded code somewhere to handle things like control boxes.
    Typically I put a combo box tied to a simple query (Selecting a vendor ID and name for the user to select .
    I then use the build function on a query and use the combo box value as my selection criteria. (i.e. use the selected Vendor ID to pull ALL orders for that vendor)
    I use this method over and over with no problems. Lately when I select forms / loaded forms (Yes I have confirmed the form is saved/ and open / Active) i can not see any of the controls to select as my criteria.
    I was assuming all of those references were actually representing coded items on my form which is why I thought no code was being added.
    See, I've learned something allready!

    So to rephrase my question then, why can't I see the combo boxes or text boxes to select when building my queries?

    Cliff

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    if you use the expression builder, you will. If you are not, suggest post some screenshots of what you are trying to do

  7. #7
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 10 Access 2016
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    If you have a combo box on form1 that you are trying to reference in a query, which i dont advise. but heres how it would work

    Code:
    Select * from tblCliffStirTable where tblCliffStirTable.FavoriteChips = [forms]![form1].form.combo1.value

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

Similar Threads

  1. Replies: 3
    Last Post: 11-16-2016, 09:24 AM
  2. Replies: 1
    Last Post: 09-25-2016, 01:43 PM
  3. Replies: 3
    Last Post: 10-15-2013, 10:54 AM
  4. adding text to a form control
    By skyline in forum Forms
    Replies: 2
    Last Post: 03-28-2013, 02:35 PM
  5. Replies: 3
    Last Post: 09-13-2011, 07:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums