![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jun 2005
Posts: 1
Rep Power: 0
![]() |
Visual Basic Help
Hi everyone i have a problem with microsoft access, where i am trying to write a program for currency exchange i.e. USD to EURO etc... i have written a piece of code in VB but every time i run the access application form and i change the currency from GBP to USD and then enter the amount in pounds in Price_Each text box i get an error message. The code is bellow:
Private Sub Price_Each_BeforeUpdate(Cancel As Integer) If Form_Purchase.ComboCurrency <> "GBP" Then price = Price_Each.Text * Form_Purchase.Rate End If Price_Each.Text = price End Sub The error message i get is: "The macro or the function set to the BeforeUpdate or ValidationRule property for this field is preventing Cost Control System from saving the data in the field" can anyone help me in solving this problem i'll be looking forward for your replies.. thanks in advance kinds regard sam Last edited by hosamuk; Jun 22nd, 2005 at 4:50 PM. |
|
|
|
|
|
#2 |
|
Hobbyist Programmer
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4
![]() |
Try sticking "Cancel = false" at the end
Im not entirely sure if that will work.
__________________
Spread your wings and fly! Chicken! |
|
|
|
|
|
#3 |
|
Expert Programmer
|
As your code stands if Form_Purchase.ComboCurrency = "GBP", Price_Each will be set to the variable price, which would be uninitialised and null (zero length string ""). However, whilst that's a bug, it's probably not the explanation for the error message. Access seems to be complaining that your code is changin the contents of the text box.
If you could post more of the code, that'd be helpful. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|