NigelShaw
Registered User.
- Local time
- Today, 23:40
- Joined
- Jan 11, 2008
- Messages
- 1,572
Hi,
this is really frustrating me as im sure its right in front of me but i cannot see it. i am adding a recordset to a table from a form via code. not every box in the form requires information ( its optional ). here is my code-
if ALL boxes contain data, the record is saved but if any of the boxes are left blank, nothing is saved. i have tried
but i just get the same.
am i missing something here?
regs
Nigel
this is really frustrating me as im sure its right in front of me but i cannot see it. i am adding a recordset to a table from a form via code. not every box in the form requires information ( its optional ). here is my code-
Code:
Private Sub EnterRecord()
Dim rs As DAO.Recordset
Dim db As DAO.Database
Set db = CurrentDb
Set rs = db.OpenRecordset("Contractors", dbOpenDynaset )
With rs
.AddNew
.FirstName = Nz( Forms!FrontForm!FirstName, Null )
.LastName = Nz( Forms!FrontForm!LastName, Null )
.CompanyName = Nz( Forms!FrontForm!CompanyName, Null )
.Position = Nz( Forms!FrontForm!Position, Null )
.StrtDate = Nz( Forms!FrontForm!StrtDate, Null )
.Update
End With
rs.close
db.Close
Set rs = Nothing
Set db = Nothing
End Sub
if ALL boxes contain data, the record is saved but if any of the boxes are left blank, nothing is saved. i have tried
Code:
.FirstName = Nz( Forms!FrontForm!FirstName, "" )
.FirstName = Nz( Forms!FrontForm!FirstName, 0 )
.FirstName = Forms!FrontForm!FirstName
but i just get the same.
am i missing something here?
regs
Nigel