johnnychow
Registered User.
- Local time
- Today, 12:27
- Joined
- Jul 28, 2011
- Messages
- 20
Private Sub Form_Load()
Dim conn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String
Dim total As Double
Set conn = CurrentProject.Connection
For i = 1 To 2
sql = "select sum([Offering Query].[Among]) from [Offering Query] where [Offering Query].[FundCode]='GEN'" & _
"and [Offering Query].[Year]=" & 2009 & _
"And [Offering Query].[Month] =" & i
rst.Open sql, conn
total = rst.GetString
rst.Close
Form_Form1.Txt(i) = total <-------Wrong? If I put a actual number then work. why? Please help!!!!!!!!!!!!Thank!
Next i
Set rst = Nothing
End Sub
Dim conn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim sql As String
Dim total As Double
Set conn = CurrentProject.Connection
For i = 1 To 2
sql = "select sum([Offering Query].[Among]) from [Offering Query] where [Offering Query].[FundCode]='GEN'" & _
"and [Offering Query].[Year]=" & 2009 & _
"And [Offering Query].[Month] =" & i
rst.Open sql, conn
total = rst.GetString
rst.Close
Form_Form1.Txt(i) = total <-------Wrong? If I put a actual number then work. why? Please help!!!!!!!!!!!!Thank!
Next i
Set rst = Nothing
End Sub