V
Vet Tech
As a relative newbie I’m trying to amend the default value of a field
in a table using tableDefs but I’m not quite getting there. I’m using
A2003.
This is a database that is used at several branch locations and each
branch needs to be able to select the default value it wants for a
field called VaryMonth in a table called tblBoxes. VaryMonth can have
a value in the range of 2 to 6.
The branch should select a value in that range from a combo box called
cmbVaryMonth in a form called frmFront which is not bound to the
table.
I’ve started out with this……………..
Private Sub cmbVaryMonth_AfterUpdate()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim strTableName As String
Set db = CurrentDb()
strTableName = "tblBoxes"
currTable = db.TableDefs(strTableName)
setTable.Fields!VaryMonth.DefaultValue = Me.CmbVaryMonth.Value
End Sub
It goes through to the last line and then it gives up with error 424.
Can someone please assist?
Yvonne
in a table using tableDefs but I’m not quite getting there. I’m using
A2003.
This is a database that is used at several branch locations and each
branch needs to be able to select the default value it wants for a
field called VaryMonth in a table called tblBoxes. VaryMonth can have
a value in the range of 2 to 6.
The branch should select a value in that range from a combo box called
cmbVaryMonth in a form called frmFront which is not bound to the
table.
I’ve started out with this……………..
Private Sub cmbVaryMonth_AfterUpdate()
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Dim strTableName As String
Set db = CurrentDb()
strTableName = "tblBoxes"
currTable = db.TableDefs(strTableName)
setTable.Fields!VaryMonth.DefaultValue = Me.CmbVaryMonth.Value
End Sub
It goes through to the last line and then it gives up with error 424.
Can someone please assist?
Yvonne