PC Review


Reply
Thread Tools Rate Thread

AfterUpdate VB If statement

 
 
ArneGolf
Guest
Posts: n/a
 
      30th Jan 2010
I am having a problem with this code:
Private Sub Cart_Shed_Number_AfterUpdate()
If (Me.Cart_Shed_Number) = "NA" And (Me.Cart_Type) = "NA" Then
Me.Cart_Shed_Fee = "0"
ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Gas" Then
Me.Cart_Shed_Fee = "10"
ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Electric" Then
Me.Cart_Shed_Fee = "20"
End If
End Sub
I want it to auto populate a "cart shed fee" field on a form depending on
the answers to the "cart shed number and cart type" fields.
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      30th Jan 2010
On Sat, 30 Jan 2010 13:38:05 -0800, ArneGolf
<(E-Mail Removed)> wrote:

>I am having a problem with this code:
>Private Sub Cart_Shed_Number_AfterUpdate()
>If (Me.Cart_Shed_Number) = "NA" And (Me.Cart_Type) = "NA" Then
> Me.Cart_Shed_Fee = "0"
>ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Gas" Then
> Me.Cart_Shed_Fee = "10"
>ElseIf (Me.Cart_Shed_Number) >= "A" And (Me.Cart_Type) = "Electric" Then
> Me.Cart_Shed_Fee = "20"
> End If
>End Sub
>I want it to auto populate a "cart shed fee" field on a form depending on
>the answers to the "cart shed number and cart type" fields.


And the problem is...? You didn't say.

What's the datatype of the Cart_Shed_Fee field in your table? I presume that
(despite its name) the Cart_Shed_Number is Text? Has the Cart_Type control
already been filled in when you select a value in Cart_Shed_Number?
--

John W. Vinson [MVP]
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add to my AfterupDate Bob Microsoft Access 7 6th Nov 2006 10:11 PM
Type 13 error in an If statement in AfterUpdate Event =?Utf-8?B?U3VzYW4gTA==?= Microsoft Access Forms 2 22nd Dec 2004 04:25 PM
afterUpdate hermie Microsoft Access Forms 2 3rd Sep 2004 11:40 AM
AfterUpdate() If Statement =?Utf-8?B?S2VubnlH?= Microsoft Access Forms 3 6th May 2004 12:43 PM
afterUpdate richard Microsoft Access Form Coding 1 24th Feb 2004 08:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:46 AM.