More Combo hell

  • Thread starter Thread starter Guest
  • Start date Start date
I have placed
Private Sub ProductName After_Update( )

msgbox me.ProductName.Column(2)
Me.UnitPrice = Me.ProductName.Column (2)

end if

in the code. when I Combiled it the error:- Compile error: End If without
block If. Was produced. Changing it ti End Sub enabled it to compile, but
there is no msgbox displayed.
 
in the code. when I Combiled it the error:- Compile error: End If without
block If. Was produced. Changing it ti End Sub enabled it to compile, but

Great, the reason why we compile each we change code is *exactly* why as
above. You are 100% correct, I should have typed
end Sub, but by habit, I typed end if (my mistake sorry - but, hey, we still
learned some cool stuff here!!!).
there is no msgbox displayed.

The msgox will ONLY display (and that code will ONLY RUN when you change the
value of the combo box. If that code does not run, then I going to suggest
that you delete the combo box. Re-create the combo box with the wizard.
then, while in design mode, display the properties sheet for that combo box,
move to the events tab, and then click on the after update field. Then click
on the [...] button that shows. Choose code, and enter your code as:

msgbox me.ProductName.Column(2)
Me.UnitPrice = Me.ProductName.Column (2)

(of course, ms-access will put in the sub -- end sub part for you. Take
careful note of the name given

eg:

ProdNme, ProductName..whatever,...your code must MATCH the name given to
the control by ms-access.

After doing the above, does the msgbox box work now? We MUST get the msg box
command to work!!! (everything else is a waste of time.....).
That msgbox will only fire (and that code only run) when you change actually
use the combo box, and change the value. So, can you get the msgbox to work?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top