Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496

    initiating a value for a combobox

    I have on a form an unbound combo box (cboPresetOption) to which I want to assign a value when the form opens.

    The user can later change it, but I want to start with a value that I get thru a DLookup()

    MY attempt at assigning the value to the control is not working, although the msgbox does provide the correct answer...



    Your thoughts and suggestions woul dbe greatly appreciated in advance,
    mark

    -----------------------------------------
    Private Sub Form_Open(Cancel As Integer)
    vtext = DLookup("[PresetTitle]", "tbeFixtureSchedulePrintOptions")
    MsgBox vtext 'this line is for debugging op
    Me.cboPresetOption = vtext
    Me.cboPresetOption.Requery
    End Sub

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    try this:

    Me.cboPresetOption.value = vtext

    and eliminate this line which I believe undoes the previous line....
    Me.cboPresetOption.Requery

    off the cuff - hope it works.....

  3. #3
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    tried both your suggestions, which to me seemed like a latenly obvious solution (which I completely missed)

    also tried Me.cboPresetOption.defaultvalue = vtext

    alas... it's still not good

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The Open event is too early in the process to reference a control on the form. Use the OnLoad event instead.

  5. #5
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    sorry, that's not it either (does it matter that the control is on a page of a tab control ?)

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    No! Each control on a TabControl has a unique name and referencing them does not include the TabControl. Doesn't work huh, hmm?

  7. #7
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    got me perplexed too...

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Does the form have a RecordSet? Try using the Current event if it does.

  9. #9
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    didn't work either (hmpft !!!)

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you got a little sample you could post so we could play?

  11. #11
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    not sure how to do that
    (sorry, self-taugh newbie here)

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use the Post Reply button and scroll down to Manage Attachments.

  13. #13
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    got that part, just not sure what to attach...
    if i exported the form, would i need to export if to a new database? what would happenn to all of the tables associated with it?
    should i simply send you screen shots of the form and it's code?
    ...and so forth

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Import just what you need into a new db.

  15. #15
    markjkubicki's Avatar
    markjkubicki is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jul 2010
    Location
    Fire Island Pines, NY
    Posts
    496
    like this? (see aattached)

    it doesn't seem like the back-end linked tables required for this form to open are working?
    (even though I've included them in the import)

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Please I need help with combobox
    By em12 in forum Access
    Replies: 1
    Last Post: 07-16-2010, 08:04 AM
  2. Combobox help
    By rnjalston in forum Forms
    Replies: 1
    Last Post: 04-02-2010, 06:37 PM
  3. help with combobox
    By ManC in forum Forms
    Replies: 0
    Last Post: 03-15-2010, 08:27 PM
  4. Replies: 0
    Last Post: 12-16-2009, 01:14 PM
  5. ComboBox Autocomplete
    By AdrianKitchen in forum Forms
    Replies: 3
    Last Post: 10-13-2009, 11:12 AM

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