e.g: InputText is 123, InputText2 is abc
I wanted to display the text inside textbox of frmCalendar as:
123
abc
instead of 123abc. how shall i use the vbCrLf?
the calender textbox "Text1, Text2,..." properties (on click) in frmCalender has source code for it. but it doesn't seems to work with this added in (see attachment):
With Forms!frmInputBox
!InputText2 = f("Text" & mynum) 'this doesn't work
!InputText2.SetFocus 'this doesn't work
End With
If you look at your code, you are trying to copy the same thing to each text box - f("Text" & mynum)
Are you saying you want to be able to enter separate data in each text box, copy the data to the calendar with a line feed, but when the calendar is clicked, split the data back into 2 fields again?
If so, I would add an extra field to your table so the data is always seperated
and then combined when required.
Dave
*Edit*
Just took anothr look at your Db and you are aleady doing that. Sorry
now 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:
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.