Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form not working for If statment

Status
Not open for further replies.

qshaz

Technical User
Feb 1, 2002
17
0
0
AE
Hello

I want a field called Deal Executed to be changed to Yes or No depending on the data in the numerical field Price Executed whenever a user entered a new record. Deal Executed is a combox box in the table itself (Yes/No), and I put an If statment in the AFter insert property that If Price Executed = "0" then Deal Executed = "No". It updates it, but when I go to close the form, it gives me a dialog box that MS Access had problems updating the database, and all my data may not be saved so do I still want to close the form. It still updates it though. The funny thing is that this used to work earlier, but after I added many additional fields and recreated the form from wizards, and added the code, it doesnt work now (i.e it gives the error). My form is in datasheet view. My old forms still work with no errors! Its very strange - does anyone have any clue why this is happening and any ideas on how to resolve it?

Thanks!
Shazia
 
Why not try the after update event for the Price Executed textbox...

Here is an example:

Private Sub Price Exceuted_AfterUpdate()
If Price Executed.value ="0" then
Deal Executed = "No"
end if

end sub

Hope this helped..
 
Thanks! That does work. Except now, my users have to manually enter 0 into the price executed field :-(

Anyway, I just fooled around, changed the names of the fields and it works now. I wonder if something is wrong with my version of Access for it to behave in this strange way!

rgds
shazia
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top