Hi,
I have been learning VB now for about a week and thought I was doing ok. I have already done a calculation form (not as big as this) . I have volunteered myself to help a friend input her hours per day into a form, start time, end time and lunch time. Then the form will calculate the amount of hours she has done for her. Sending results to access is not an issue yet!
When I have entered the below code and tested it, it let's me input hours, I press calculate then says compile error, method or data member not found. I press ok and .text is highlighted. I have noticed when I delete .text and type it again only 4 options instead of loads comes up. So really it's not letting me selct it as .text.
I was up til 4 this morning with this so any help and I would be eternally grateful.
Dim SunTotal As Variant
Dim MonTotal As Variant
Dim TuesTotal As Variant
Dim WedsTotal As Variant
Dim Thurstotal As Variant
Dim FriTotal As Variant
Dim SatTotal As Variant
Dim HoursTotal As Variant
Dim valsunend As Variant
Dim valmonend As Variant
Dim valtuesend As Variant
Dim valwedsend As Variant
Dim valthursend As Variant
Dim valfriend As Variant
Dim valsatend As Variant
Dim valsunstart As Variant
Dim valmonstart As Variant
Dim valtuesstart As Variant
Dim valwedsstart As Variant
Dim valthursstart As Variant
Dim valfristart As Variant
Dim valsatstart As Variant
Dim valsunlunch As Variant
Dim valmonlunch As Variant
Dim valtueslunch As Variant
Dim valwedslunch As Variant
Dim valthurslunch As Variant
Dim valfrilunch As Variant
Dim valsatlunch As Variant
Private Sub CmdCalculate_Click()
valsunend = Val(TxtSunEnd.Text)
valmonend = Val(TxtMonEnd.Text)
valtuesend = Val(TxtTuesEnd.Text)
valwedsend = Val(TxtWedsEnd.Text)
valthursend = Val(TxtThursEnd.Text)
valfriend = Val(TxtFriEnd.Text)
valsatend = Val(TxtSatEnd.Text)
valsunstart = Val(TxtSunStart.Text)
valmonstart = Val(TxtMonStart.Text)
valtuesstart = Val(TxtTuesStart.Text)
valwedsstart = Val(TxtWedsStart.Text)
valthursstart = Val(TxtThursStart.Text)
valfristart = Val(TxtFriStart.Text)
valsatstart = Val(TxtSatStart.Text)
valsunlunch = Val(TxtSunLunch.Text)
valmonlunch = Val(TxtMonLunch.Text)
valtueslunch = Val(TxtTuesLunch.Text)
valwedslunch = Val(TxtWedsLunch.Text)
valthurslunch = Val(TxtThursLunch.Text)
valfrilunch = Val(TxtFriLunch.Text)
valsatlunch = Val(TxtSatLunch.Text)
SunTotal = valsunend - valsunstart - valsunlunch
MonTotal = valmonend - valmonstart - valmonlunch
TuesTotal = valtuesend - valtuesstart - valtueslunch
WedsTotal = valwedsend - valwedsstart - valwedslunch
Thurstotal = valthursend - valthursstart - valthurslunch
FriTotal = valfriend - valfristart - valfrilunch
SatTotal = valsatend - valsatstart - valsatlunch
HoursTotal = SunTotal + MonTotal + TuesTotal + WedsTotal + Thurstotal + FriTotal + SatTotal
LblHours.Caption = HoursTotal
End Sub
5 2712
Hi,
Do you get Error on all the lines of "txt.Text"...?
Instead of Variant, Try to Decalare all the Variables as Single/Double Or Currency..
Regards
Veena
Hi,
Do you get Error on all the lines of "txt.Text"...?
Instead of Variant, Try to Decalare all the Variables as Single/Double Or Currency..
Regards
Veena
Hi I'll try it now,
Thanks for swift response - letyou know!
Hi, Changed all to double, same response. When you say on all lines I don't know because it only shows first line of problem:
Private Sub CmdCalculate_Click() (being in yellow)
valsunend = Val(TxtSunEnd.Text) (.text being highlighted blue.
The strange thing is that when I go to type something like text1.text on another project it'll offer me the option of filling .text in for me. This project isn't doing that. The auto fill has only 4 options - count, item, lbound and ubound.
Can't get my head around it.
The strange thing is that when I go to type something like text1.text on another project it'll offer me the option of filling .text in for me. This project isn't doing that. The auto fill has only 4 options - count, item, lbound and ubound.
Can't get my head around it.
Hi,
OK, By mistake, you have created a Control Array of TextBoxes.
In Design Mode, Go to the properties of each TextBox, and Clear Value from this property: "Index" (it will be some Integer value 0,1,..)
Just Take Care that No TextBox Name is Repeated..
Regards
Veena
Thank you so much it worked!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Building Blocks |
last post by:
Hi,
All I need is a simle calculate form script which contains this:
A script that can handle text input, radio buttons, checkboxes, and
dropdowns. Each one of these variables will contain a...
|
by: Don Leverton |
last post by:
Hi Folks,
I *can* calculate the Gross Profit Percentage where both the Cost and
SellPrice are known, using the formula:
(SellPrice - Cost) / SellPrice = GPP
eg ($24.92 - $14.95) / $24.92 =...
|
by: Martin Herbert Dietze |
last post by:
Hi,
I need to calculate the physical length of text in a text
input. The term "physical" means in this context, that I
consider 7bit-Ascii as one-byte-per character. Other characters
may be...
|
by: paii, Ron |
last post by:
Sorry about that last one.
Does anyone know how to calculate the width a string of text for given Font
name and size?
I want to buildup a block of text strings to display in a unbound control,...
|
by: Umesh |
last post by:
Plese help. Is there any software by which we can do that?
|
by: Learner |
last post by:
Hello,
I recently converted a VS 2003 application to VS 2005. When I
compile it in VS 2005 every thing gets compiled with no errors. But
when I try publishing the website I get all different...
|
by: coolguyraj |
last post by:
I have a javascript code to take value from two text boxes and calculate on triggering the "OnBlur" function and display in the third box.
The code works fine with one line item,If i have more...
|
by: brendanmcdonagh |
last post by:
Hi,
I am designing a project for my friend as I am just a week old baby to vb and want to implement what I've learnt so far.
She wants to be able to put start time, end time and lunch for each...
|
by: tonyhhisc |
last post by:
This script calculates the total "listing_fee" based on the price that the user inputs into the "price" field. It works in Firefox but IE says "OBJECT NOT FOUND" please help me debug this, It's...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |