Count Value as half

S

SoggyCashew

I have a module that counts how many times a word is used in the table
tblInput and show the number in a text box on my form. for this example I
wnat to use the word "Half Day" and have it show in a text box "txtHD". Here
is what im using to show the value as 1 but how do I show it as .5.

Public Function GetVacationAndHolidays()
Dim strSql
Dim frm As Form
Dim db As DAO.Database
Dim rs As DAO.Recordset

Set frm = Forms!frmCalendar
Set db = CurrentDb

Set frm = Forms!frmCalendar
Set db = CurrentDb
'Half Day
strSql = "SELECT Count(InputID) AS TotDays FROM tblInput "
strSql = strSql & "WHERE ((Format([InputDate], 'yyyy')=" &
CInt(gstrYear) & ") AND ((tblInput.UserID)=" & glngUserID & ") AND
((tblInput.InputText)='Half Day'));"
Set rs = db.OpenRecordset(strSql, dbOpenSnapshot)
frm!txtHD = rs!TotDays
rs.Close
strSql = "'"

Set rs = Nothing
db.Close
Set db = Nothing
End Function
 
S

SoggyCashew

Thanks Clifford that worked and this did as well!

strSql = "SELECT Count(InputID) /2 AS TotDays FROM tblInput "

--
Thanks,
Chad


Clifford Bass said:
Hi Chad,

How about:

frm!txtHD = rs!TotDays / 2

Clifford Bass

SoggyCashew said:
I have a module that counts how many times a word is used in the table
tblInput and show the number in a text box on my form. for this example I
wnat to use the word "Half Day" and have it show in a text box "txtHD". Here
is what im using to show the value as 1 but how do I show it as .5.

Public Function GetVacationAndHolidays()
Dim strSql
Dim frm As Form
Dim db As DAO.Database
Dim rs As DAO.Recordset

Set frm = Forms!frmCalendar
Set db = CurrentDb

Set frm = Forms!frmCalendar
Set db = CurrentDb
'Half Day
strSql = "SELECT Count(InputID) AS TotDays FROM tblInput "
strSql = strSql & "WHERE ((Format([InputDate], 'yyyy')=" &
CInt(gstrYear) & ") AND ((tblInput.UserID)=" & glngUserID & ") AND
((tblInput.InputText)='Half Day'));"
Set rs = db.OpenRecordset(strSql, dbOpenSnapshot)
frm!txtHD = rs!TotDays
rs.Close
strSql = "'"

Set rs = Nothing
db.Close
Set db = Nothing
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top