Bouldergirl
Technical User
Hi there,
I've got a function and within it are embedded 2 other functions (CalcAsin2 and CalcGDD), which are called from within the main function. The code seems to run (i.e., no error messages, and the output table that I create is made and populated with most of the values I want) but the two columns that should be filled with values generated by my Functions CalcAsin2 and CalcGDD are populated with empty cells instead.
Any help on this matter would be greatly appreciated!
Thanks,
-Tiffany
The code is:
Option Compare Database
Function CalculateHeatUnits()
Dim db As Database
Dim tdfNew As TableDef
Dim rin, rout, T_mean, T_range, theta, Pmon, GDD, Asin2
ofilename = "growing_degree_day_test2"
Set db = CurrentDb()
For i = 0 To db.TableDefs.Count - 1 ' Delete table
If db.TableDefs(i).Name = ofilename Then
DoCmd.DeleteObject A_TABLE, ofilename
Exit For
End If
Next
Set tdfNew = db.CreateTableDef(ofilename)
With tdfNew
.Fields.Append .CreateField("grid", dbLong)
.Fields.Append .CreateField("month", dbbyte)
.Fields.Append .CreateField("GDD_test", dbSingle)
.Fields.Append .CreateField("theta_test", dbSingle)
.Fields.Append .CreateField("asin_theta", dbSingle)
.Fields.Append .CreateField("Tm", dbSingle)
.Fields.Append .CreateField("Tr", dbSingle)
db.TableDefs.Append tdfNew
End With
Set rinwd = db.OpenRecordset("GDD_test_input2")
Set rout = db.OpenRecordset(ofilename)
I've got a function and within it are embedded 2 other functions (CalcAsin2 and CalcGDD), which are called from within the main function. The code seems to run (i.e., no error messages, and the output table that I create is made and populated with most of the values I want) but the two columns that should be filled with values generated by my Functions CalcAsin2 and CalcGDD are populated with empty cells instead.
Any help on this matter would be greatly appreciated!
Thanks,
-Tiffany
The code is:
Option Compare Database
Function CalculateHeatUnits()
Dim db As Database
Dim tdfNew As TableDef
Dim rin, rout, T_mean, T_range, theta, Pmon, GDD, Asin2
ofilename = "growing_degree_day_test2"
Set db = CurrentDb()
For i = 0 To db.TableDefs.Count - 1 ' Delete table
If db.TableDefs(i).Name = ofilename Then
DoCmd.DeleteObject A_TABLE, ofilename
Exit For
End If
Next
Set tdfNew = db.CreateTableDef(ofilename)
With tdfNew
.Fields.Append .CreateField("grid", dbLong)
.Fields.Append .CreateField("month", dbbyte)
.Fields.Append .CreateField("GDD_test", dbSingle)
.Fields.Append .CreateField("theta_test", dbSingle)
.Fields.Append .CreateField("asin_theta", dbSingle)
.Fields.Append .CreateField("Tm", dbSingle)
.Fields.Append .CreateField("Tr", dbSingle)
db.TableDefs.Append tdfNew
End With
Set rinwd = db.OpenRecordset("GDD_test_input2")
Set rout = db.OpenRecordset(ofilename)