Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 22nd, 2005, 4:46 PM   #1
hosamuk
Newbie
 
Join Date: Jun 2005
Posts: 1
Rep Power: 0 hosamuk is on a distinguished road
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.
hosamuk is offline   Reply With Quote
Old Jun 23rd, 2005, 7:58 AM   #2
rsnd
Hobbyist Programmer
 
rsnd's Avatar
 
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4 rsnd is on a distinguished road
Try sticking "Cancel = false" at the end
Im not entirely sure if that will work.
__________________
Spread your wings and fly! Chicken!
rsnd is offline   Reply With Quote
Old Jun 23rd, 2005, 8:09 AM   #3
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
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.
Rory is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:40 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC