presence76
MIS
I have a form that has a textbox in it. I am using the information to update a table in ACCESS. I am getting "invalid use of null" on this line:
newmgmtcode = Forms![form1]![textmgmtcode]
I have also tried
newmgmtcode = Forms![form1]![textmgmtcode].Value
Either way, I get invalid use of null.
Here is the full code:
Function fcnaddmgmtcode()
Dim newmgmtcode As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb()
newmgmtcode = Forms![form1]![textmgmtcode]
Set rst = dbs.OpenRecordset("tblmgmtcodecurrent")
With rst
.AddNew
.Fields(1) = newmgmtcode
.Update
End With
End Function
The strange thing is that it was working, intermittently. The first time it failed, I walked it through the debugger and then it worked. Then, when I opened the DB again, it failed. Any ideas????
All help is greatly appreciated. Thanks.
newmgmtcode = Forms![form1]![textmgmtcode]
I have also tried
newmgmtcode = Forms![form1]![textmgmtcode].Value
Either way, I get invalid use of null.
Here is the full code:
Function fcnaddmgmtcode()
Dim newmgmtcode As String
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Set dbs = CurrentDb()
newmgmtcode = Forms![form1]![textmgmtcode]
Set rst = dbs.OpenRecordset("tblmgmtcodecurrent")
With rst
.AddNew
.Fields(1) = newmgmtcode
.Update
End With
End Function
The strange thing is that it was working, intermittently. The first time it failed, I walked it through the debugger and then it worked. Then, when I opened the DB again, it failed. Any ideas????
All help is greatly appreciated. Thanks.