Results 1 to 5 of 5
  1. #1
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239

    Continous subform - display two comboboxes on start

    Hi,

    I have a continous subform with combobox in It. _It is set to allow only two entries (VBA code). Can I set It to show two Comboboxes on start too, without VBA ? Because once you enter first record, antoher Combobox underneath appears for new entry. I just want them both on start allready, without any entries in first record.

    Any help appreciated !

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,934
    short answer is no - you either display an existing record(s), a new record being created and/or a row for a new record. You can't show two rows for new records.

    Only way would be to have some vba code to create two blank records (tho will no doubt have an autonumberPK completed and requires the table to allow blank fields), then set your form to not allow additions.

  3. #3
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    What about If I pass "" string to combobox on master form load_event, If there is no records in subform? That should "open" new autonumber, then user will change data in first combobox, and second combobox should open as well ??

    This is what I tried, but strangely nothing happens:

    Code:
    Dim NumRecs As Integer
    
    
    With Forms![MyForm]![MySubform].Form
    NumRecs = .RecordsetClone.RecordCount
    If IsNull(NumRecs) Then Combo7.Value = ""
    End With
    EDIT: I'm sorry, I see that you allready suggested that. So, where's flaw in my code ?

  4. #4
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,934
    updating values by code does not trigger the same behaviour as entering a value manually - you need to save the record

  5. #5
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    updating values by code does not trigger the same behaviour as entering a value manually - you need to save the record
    Not quite true. I got It working, just needed to put code in module and call It from Load_event of master form :

    Code:
    Sub SendStringToRecord()
    
    
    With Forms![MyForm]![MYSubform].Form
    If .RecordsetClone.RecordCount = 0 Then
    Forms![MyForm]![MySubform]![MySubformCombo7].Value = ""
    End If
    End With
    
    End Sub
    This code generates new Autonumber If there are no records. Result is that subform creates another Combobox for new record entry. However, in targeted table a number of master record is created (ID of master form record), but that's no problem in my case, since both Comboboxes are going to be filled in every master form record. So when user will select drop-down list from 1st Combobox that looks like with no value and select another value, Autonumber will not change, just data.

    I'm closing this thread. Thanks for all help though !!

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

Similar Threads

  1. Auto-resize continous subform
    By Lukael in forum Programming
    Replies: 12
    Last Post: 12-03-2015, 03:21 AM
  2. Replies: 4
    Last Post: 03-01-2013, 11:49 AM
  3. Subform with Comboboxes
    By Angate in forum Forms
    Replies: 5
    Last Post: 04-23-2010, 08:10 PM
  4. subform comboboxes/Textboxes
    By terryvanduzee in forum Forms
    Replies: 2
    Last Post: 11-19-2009, 07:41 PM
  5. Refreshing comboboxes in a subform
    By KB_Dev in forum Programming
    Replies: 1
    Last Post: 04-07-2009, 12:12 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