borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2012 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Next Topic (Is it possible to creat a user id and password to access database?) New Topic New Poll Post Reply
AndreaVB Forum : Database : Combo and Text Box
Poster Message
spuk
Level: Trainee

Registered: 29-03-2010
Posts: 2

icon Combo and Text Box

Hi everyone

I would appreciate it if someone could advise me on how to solve problem I'm having.

What I am trying to do is this:
If user select numeric up down value for Text Box (Detention)
which depends on a data table entry and selection from Combo Box labeled (Service)

How to code a calculation in blocks of 5min?
ex. 5min detention based on Combo selection for Service Type (SVT) equals $1.40
or 10min = $2.80 etc.
As well as how to display it to my text box?    

I am newbie and this task is over my head so any help would be much appreciated.

Thanks


[Edited by spuk on 30-03-2010 at 08:39 AM GMT]

29-03-2010 at 07:26 AM
View Profile Send Email to User Show All Posts | Quote Reply
GeoffS
Level: VB Lord


Registered: 29-09-2004
Posts: 640
icon Re: Combo and Text Box

Bit difficult to answer this without knowing which development tools you are using. But since you have posted this in the "Database" Forum I will assume you are using MS Access.
So the ComboBox will contain 3 columns filled with a query against the database table that holds the ServiceType Data -
ServiceTypeID (Column width set to Zero to hide display), ServiceTypeDescription (Column width set to width of Combo to display the description),  ServiceTypeUnitCost (Column width set to Zero to hide display),  - so when the user selects a ServiceType from the list and fires the Click Event you can retrieve the cost and place it into a variable which you can then multiply by the Detention value in the updown textbox divided by 5 (the value of each increment). The result can then be displayed in a textbox.

Private Sub ComboServiceType_Click()
Dim curServiceTypeCost as Currency
Dim intDetention as Integer
Dim curResult as Currency

curServiceTypeCost  = ComboServiceType.Column(2)
intDetention = txtUpDown / 5
curResult = curServiceTypeCost  * intDetention
TextBoxResult = Format(curResult, "Currency")





____________________________
multi-tasking - the ability to hang more than one app. at the same time.

29-03-2010 at 11:13 AM
View Profile Send Email to User Show All Posts | Quote Reply
spuk
Level: Trainee

Registered: 29-03-2010
Posts: 2
icon Re: Combo and Text Box

Hi Geoffs,

Thanks for your replay, I did attached zip file of my Table and diagram of what I would like to do but for some reason it didn't showed up.

Therefore I,m attaching a JPEG version of the same file. Hope that will make  more sense.

In a mean time I am going to try out your suggestion.

Thanks

30-03-2010 at 08:56 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Combo and Text Box
Next Topic (Is it possible to creat a user id and password to access database?) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2012 Andrea Tincaniborder