The code below will create a new field based on the current business day. i want to be able to assign this field a value (SumAmount = CDbl(DSum("[market_value£]", "tbl(9) Borrows_cash_term_alloc_stk")). Can anyone tell me how I do it.
I know how to do using sql but i thought there must be away to set the value when the field is created. many thanks
On Error GoTo ErrHandler
Dim dbCode As Database
Dim tbl As TableDef
Dim sPath As String
Set dbCode = DBEngine(0)(0)
Dim newfld As Field
Dim strSql As String
Dim SumAmount As Double
Set tbl = dbCode.TableDefs(sTable)
Set newfld = tbl.CreateField(FieldName, dbDouble)
tbl.Fields.Append newfld
tbl.Fields.Refresh
I know how to do using sql but i thought there must be away to set the value when the field is created. many thanks
On Error GoTo ErrHandler
Dim dbCode As Database
Dim tbl As TableDef
Dim sPath As String
Set dbCode = DBEngine(0)(0)
Dim newfld As Field
Dim strSql As String
Dim SumAmount As Double
Set tbl = dbCode.TableDefs(sTable)
Set newfld = tbl.CreateField(FieldName, dbDouble)
tbl.Fields.Append newfld
tbl.Fields.Refresh