Results 1 to 6 of 6
  1. #1
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368

    combobox value dependant on value in control

    I have a control called Pnummer (its personell number).
    After a user enters this number i want my combobox called Kenteken (Licenseplate number) to fill with only the licence plate numbers of the employee from the table Parkeerbeheer (Parking management)

    Should be simple enough, its like cascading comboboxes but then with only one combobox.

    So i put this code in the afterupdate event of the Pnummer control :

    Code:
    On Error Resume Next
       kzlKenteken.RowSource = "Select parkeerbeheer.kenteken " & _
                "FROM parkeerbeheer " & _
                "WHERE parkeerbeheer.pnummer = '" & fldPnummer.Value & "' " & _
                "ORDER BY parkeerbeheer.kenteken;"
    I have left the rowsource blanc as above code handles that.

    The only thing that comes to mind why it doesn't work is that the table bound to this form is NOT the source where i pull the licenceplate numbers from.


    Any idea's or help is greatly appreciated, after trying for two days now im pulling my hair out !

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    pnummer is a text field type, not number?

    Have to requery the combobox.

    You say the control is pnummer but you have it as the field in the sql and you have fldPnummer as the control name. Which way is correct?

    Why not set the sql directly in the RowSource property?

    SELECT kenteken FROM parkeerbeheer WHERE pnummer = [fldPnummer] ORDER BY kenteken;

    Then the event code is just:

    Me.Kenteken.Requery
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    Sorry June the control is indeed fldPnummer. The field in the table is Pnummer.

    In the afterupdate event of fldPnummer i put

    Code:
    me.kzlKenteken.requery
    But still the combobox remains empty
    Im pondering what im doing wrong..

    Oh and btw, the field is text indeed.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    The list is still not showing items?

    Want to provide db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    JeroenMioch's Avatar
    JeroenMioch is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2012
    Location
    Den Haag, Netherlands
    Posts
    368
    That isnt possible, db is far too large :P
    Im gonna try something else, ill let you know how it works ou

    Thanks for the time mate !

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Have you tried removing "On Error Resume Next" from your code in post #1 and then running your app?

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

Similar Threads

  1. Using a Combobox to control a Subform
    By accessuser10 in forum Access
    Replies: 3
    Last Post: 11-26-2013, 10:59 AM
  2. ComboBox To Control a Data Sheet
    By m011 in forum Forms
    Replies: 6
    Last Post: 11-20-2013, 12:42 PM
  3. Combobox control for linked form/subform
    By Dbusse706 in forum Access
    Replies: 2
    Last Post: 07-03-2012, 07:49 PM
  4. Wildcard search within ComboBox to control RowSource
    By CaptainKen in forum Programming
    Replies: 22
    Last Post: 05-16-2012, 02:19 PM
  5. Use combobox to control Subform
    By bundy75 in forum Forms
    Replies: 2
    Last Post: 09-22-2010, 03:31 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