Home > Microsoft Access Help > Computing of datas

Computing of datas



hi,



anyone can help me ( refer to attachment) how can i compute datas stored in "tblInput"

e.g:

-to compute the total monthly value for "InputText" and display at a box (have not created yet) inside frmCalender



-to compute the total monthly value for "InputText2" and display at the other box (have not created yet) inside frmCalender



* there is some problem that i still have not solve in the textboxs of (frmInputBox). e.g for a date whose datas are:



20

17



20 should be in InputText

17 should be in InputText2



thank you.

    
Guest


Welcome to the forums

There are no attachments

If you'd like to create calculations the most simple way would be on a new InputText the following formula:

=InputText + InputText2

This of course contains no data input checking. For more on form calculations take a look here

Was this answer helpful ? Yes No   
Guest


sorry, seems like i can't upload any file here. the file can be download from my site:



thank you

Was this answer helpful ? Yes No   
Guest


I don't think you can if the file size is too big.

Anyhow, you can always try using the logic I provided you with on my previous post.

Was this answer helpful ? Yes No   
Guest


thank you, seems like i can't find any upload button here to upload my file.



here is the query (hope u can understand):



i have added a textbox called "InputTextResult" in frmCalender.

- the function of the "InputTextResult" is to display the (results of adding all the values in InputText of the month).



e.g (datas collected for the month):



45 3 22 = 70 ( result of InputText)

21 1 16 = 38 (result of InputText2)



shall temporary ignore the InputText2 because its something similar to InputText.



here is what i edit in Public Sub PutInData() :


Code:




Public Sub PutInData()
Dim sql As String
Dim f As Form
Dim Db As DAO.Database
Dim rs As DAO.Recordset
Dim i As Integer
Dim InputTextAdder As Integer 'ariel81
Dim ans As Integer 'ariel81
Dim myDate As Date

Set f = Forms!frmCalendar
ans = 0 'ariel81
InputTextAdder = 0 'ariel81


'Empty out the previous month
For i = 1 To 37
f("text" & i) = Null
f("text" & i).BackColor = 10944511
Next i

'Construct a record source for the month
sql = "SELECT * FROM [tblInput] WHERE ((MONTH(InputDate) = " & f!month & " AND YEAR(InputDate)= " & f!year & ")) ORDER BY InputDate;"

Set Db = CurrentDb()
Set rs = Db.OpenRecordset(sql, dbOpenSnapshot)

'Populate the calendar
If rs.RecordCount > 0 Then
For i = 1 To 37
If IsDate(f("date" & i)) Then
myDate = Format((f("date" & i)), "mm/dd/yyyy")
rs.FindFirst "InputDate = #" & myDate & "#"
If Not rs.NoMatch Then
f("text" & i) = rs!InputText & Chr(13) & Chr(10) & rs!InputText2
InputTextAdder = rs!InputText 'ariel81
ans = InputTextAdder + InputTextAdder 'ariel81
f("InputTextResult") = ans 'ariel81
f("text" & i).BackColor = 12058551
Else
f("text" & i).BackColor = 10944511
End If
End If
Next i
End If

End Sub






codes added inside:



Dim InputTextAdder As Integer

Dim ans As Integer



ans = 0

InputTextAdder = 0



If Not rs.NoMatch Then

f("text" & i) = rs!InputText & Chr(13) & Chr(10) & rs!InputText2

InputTextAdder = rs!InputText 'ariel81

ans = InputTextAdder + InputTextAdder 'ariel81

f("InputTextResult") = ans 'ariel81

f("text" & i).BackColor = 12058551

Else



* the ans of adding InputText doesn't seems correct.

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved