Results 1 to 6 of 6
  1. #1
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88

    Blocking User Text in ComboBox Problem

    I have 2 programs that use the code below to block users from entering text into a comboBox:

    Private Sub comboBox_KeyPress(KeyAscii As Interger)
    KeyAscii = 0
    End Sub

    One works fine while the other gives me the error below:



    "The expression On Key Press you entered as the event property setting produce the following error: Procedure declaration does not match description of event or procedure having the same name"

    I've tried different versions of the code and does the same thing. The comboBox has its own table and has a relationship between the main table and the comboBox.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    did you see if there were 2 : Private Sub comboBox_KeyPress routines in the code?

    (ctl-F to find them)

  3. #3
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    actually there is nothing else but that routine...and now i wrote a cancel routine instead of using the macro and it says:

    "A problem occurred while the program was communicating with the OLE server or ActiveX control"

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    Wouldn't setting the Limit To List property to Yes be simpler?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  5. #5
    davegri's Avatar
    davegri is online now Excess Access
    Windows 10 Access 2016
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,413
    That error usually means that you have linked an event from the combobox to code that calls the combobox by the wrong name. Make sure the combobox control name matches the event code name.
    Private Sub comboBox_KeyPress(KeyAscii As Interger)

  6. #6
    ortizimo is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Jun 2017
    Location
    FL
    Posts
    88
    Any code I enter comes up with some strange error. I started from scratch and enter code without any issues so I guess its fixed. There are no other comboboxes, etc with the same name...its in macro it works fine...anything else errors out. Thanks everyone.

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

Similar Threads

  1. Replies: 4
    Last Post: 03-22-2017, 08:00 AM
  2. Blocking record access
    By shadowsedge in forum Forms
    Replies: 0
    Last Post: 03-30-2016, 10:27 AM
  3. blocking blank spaces on a subform
    By Paintballlovr in forum Forms
    Replies: 5
    Last Post: 12-06-2013, 05:22 PM
  4. Replies: 3
    Last Post: 05-16-2013, 08:21 PM
  5. Procedure for Blocking Multiple Users?
    By JonMulder in forum Programming
    Replies: 3
    Last Post: 04-04-2013, 05:02 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