none
help correcting error 2046

    Question

  • Hi

    I am getting an error message the tells me the command or action isnt available at this time with the error number 2046. Im using a Macro event to try and refresh the form. My reason for using the refresh is that I have a combo box that will populate with data based on the selection of another combo box.

    I get to the form that I am having this problem with by way of another form. I have a form (NavigationPanel) that is opened when the database is started. I click on a command button (search_button) that opens the form where the error is occuring (QBF_Form). I have looked online and from what I have read it seems that this error occurs because of the way that the form is being opened, but im not positive.

    Is there a way to work around this error?

    thanks

    nick

    Wednesday, July 11, 2012 4:02 PM

Answers

  • Sorry my mistake.

    try

    Private Sub cmpnt_mfr_AfterUpdate()
        cmpnt_mod.RowSource = "SELECT Vendors.cmpnt_mod_name FROM Vendors WHERE ((Vendors.cmpnt_mfr_name) Like """ & "*" & [cmpnt_mfr] & "*" & """)"
    End Sub

    Masig

    • Marked as answer by nickjohnson Wednesday, July 11, 2012 8:36 PM
    Wednesday, July 11, 2012 8:33 PM

All replies

  • Hi Nickjonson,

    Error 2046 is a problematic one, I've personally got it on more than one occasion,
    Once it was a bad coding second time my form was losing its focus.
    So you have to give us more information on the way you manipulating your combos.

    Masig

    Wednesday, July 11, 2012 6:58 PM
  • I can do that although I'm not sure what information would be helpful as I don't know the nature of the error other than it says "the command or action isn't available at this time"

    please let me know what information you need and I will do my best to give it to you so you can help me.

    thank you

    nick

    Wednesday, July 11, 2012 7:01 PM
  • I need first ComboBox.RowSource , then what are you doing on its after update event.
    What is second ComboBox.RowSource?  At which point are you calling the macro?

    Masig

    Wednesday, July 11, 2012 7:30 PM
  • I need first ComboBox.RowSource , then what are you doing on its after update event.
    What is second ComboBox.RowSource?  At which point are you calling the macro?

    Masig

    The first combo box (named cmpnt_mfr) row source is: SELECT DISTINCT Vendors.cmpnt_mfr_name FROM Vendors;

    This combo box has a macro procedure "Refresh" embedded in the After Update Event

    The second combo box (named cmpnt_mod) row source is: SELECT Vendors.cmpnt_mod_name FROM Vendors WHERE (((Vendors.cmpnt_mfr_name) Like [Forms]![QBF_Form]![cmpnt_mfr]));

    The message box that pops up after cmpnt_mfr is updated is as follows:

    After I press OK I get another message box that says:

    I hope this is helps! I have used refresh in another form in the same data base and it works fine so im not sure why it wont work in this one.

    thanks for all your help

    nick

    Wednesday, July 11, 2012 7:39 PM
  • Why so complicated?
    Just in a code builder of cmpnt_mfr  on after update even put the following code:

    Private Sub cmpnt_mfr_AfterUpdate()
        cmpnt_mod.RowSource = "SELECT Vendors.cmpnt_mod_name FROM Vendors WHERE ((Vendors.cmpnt_mfr_name) Like *' & [cmpnt_mfr] & '*);"
    End Sub

    Masig

    Wednesday, July 11, 2012 8:08 PM
  • I probably made it more complicated by learn vba and access as I went and got it to work that way in another form.

    I entered the code you suggested and It returned this message box:

    Im pretty sure I entered in the code just as you have above but he is what I have just in case:

    Private Sub cmpnt_mfr_AfterUpdate()
        cmpnt_mod.RowSource = "SELECT Vendors.cmpnt_mod_name FROM Vendors WHERE ((Vendors.cmpnt_mfr_name) Like *' & [cmpnt_mfr] & '*);"
         
    End Sub

    Thank you

    Nick

    Wednesday, July 11, 2012 8:20 PM
  • Sorry my mistake.

    try

    Private Sub cmpnt_mfr_AfterUpdate()
        cmpnt_mod.RowSource = "SELECT Vendors.cmpnt_mod_name FROM Vendors WHERE ((Vendors.cmpnt_mfr_name) Like """ & "*" & [cmpnt_mfr] & "*" & """)"
    End Sub

    Masig

    • Marked as answer by nickjohnson Wednesday, July 11, 2012 8:36 PM
    Wednesday, July 11, 2012 8:33 PM
  • Works exactly how I was hoping thank you!

    Nick

    Wednesday, July 11, 2012 8:37 PM