Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop drive driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory missing monitor motherboard network printer problem ram random registry router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
Need help with If Then statment with Access text box

Reply  
Thread Tools
rhodeskenneth's Avatar
Junior Member with 1 posts.
 
Join Date: Nov 2009
13-Nov-2009, 12:06 AM #1
Need help with If Then statment with Access text box
I have a text box and want the text box 15 to be updated if the text box 12 have Q1, Q2, Q3, Q4 VALUES. I get the error messeage that an object is required. Thanks in advance for your help


Private Sub Text15_Click()
If TextBox.Text12 = "Q1" Then
TextBox.Text15 = "13"
ElseIf Text12 = "Q2" Then
TextBox.Text15 = "26"
ElseIf Text12 = "Q3" Then
TextBox.Text15 = "39"
ElseIf Text12 = "Q4" Then
TextBox.Text15 = "52"
End If
End Sub
zhouma's Avatar
Member with 115 posts.
 
Join Date: Aug 2009
13-Nov-2009, 12:27 AM #2
Hi rhodeskenneth,

Welcome!

The text box is on a form, right? If so, try the following and see if it works.

Private Sub Text15_Click()
If Me.Text12 = "Q1" Then
Me.Text15.value = "13"
ElseIf Me.Text12 = "Q2" Then
Me.Text15.value = "26"
ElseIf Me.Text12 = "Q3" Then
Me.Text15.value = "39"
ElseIf Me.Text12 = "Q4" Then
Me.Text15.value = "52"
End If
End Sub

I'm not to sure if you need more End If's at the end but I know that this will at least get you started.

Best,
Zhouma
zhouma's Avatar
Member with 115 posts.
 
Join Date: Aug 2009
18-Nov-2009, 10:12 AM #3
Hi rhodeskenneth,

How did the code I posted for you work out?

Best,
Zhouma
JoshRod's Avatar
Computer Specs
Member with 125 posts.
 
Join Date: Nov 2009
Experience: Intermediate
28-Nov-2009, 12:35 PM #4
Mmm, working with RB here? Great programming language to use. Learning it currently in my school. Would you be able to tell me everything such as the text that you named your static text fields? The code you put down rhodeskenneth seems fairly right. As long as you have the static fields and whatever else you have in your program is labeled correctly, it should be fine. Tell me what you named your static text fields along with everything else that you have such as a PushButton, a Scrollbar, PopUp Menu, or whatever you have in your program, tell me and I'll see what I can do. Zhouma, only one End If is needed because when you put a then, the elseif is there to to back it up just in case the statement returns false.
zhouma's Avatar
Member with 115 posts.
 
Join Date: Aug 2009
29-Nov-2009, 11:30 PM #5
Quote:
Originally Posted by JoshRod View Post
Zhouma, only one End If is needed because when you put a then, the elseif is there to to back it up just in case the statement returns false.
Oh ok. Thanks, JoshRod for confirming re: the End If.

Best,
Zhouma
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:47 AM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.