Hi all.
I'm copying the record from one table (shown in a form) over to another table. This is the code I've done (no doubt you'll all be disgusted at it... I've only learned off these forums really so I know I don't code correctly!)
I put the vbNullStrings in because not all fields on the original form may be filled in and so I thought that would handle the null values - my problem is that it won't work for the Date type.
So my question is, how do I manage a potential Null value on the Date field/type?
Of course, any other observations and recommendations would be most gratefully received!
I'm copying the record from one table (shown in a form) over to another table. This is the code I've done (no doubt you'll all be disgusted at it... I've only learned off these forums really so I know I don't code correctly!)
Code:
lngTenderID = Me.TenderID.Value
strJobNo = vbNullString & Me.JobNo.Value
intOrgID = Me.OrgID.Value
lngContactID = vbNullString & Me.ContactID.Value
intStaffID = vbNullString & Me.StaffID.Value
strTitle = Me.TenderTitle.Value
strSummary = vbNullString & Me.TenderSummary.Value
strMethodology = vbNullString & Me.TenderMethodology.Value
dtDateSubmitted = Me.DateSubmitted.Value
Set db = CurrentDb
Set rsNewContract = db.OpenRecordset("TBLContractInfo", dbOpenTable, dbAppendOnly)
With rsNewContract
.AddNew
[TenderID] = lngTenderID
[ContractCode] = strJobNo
[OrgID] = intOrgID
[ContactID] = lngContactID
[SDPContractManagerID] = intStaffID
[ContractName] = strTitle
[SummaryofWork] = strSummary
[Methodology] = strMethodology
[TenderSubmittedDate] = dtDateSubmitted
[ContractConfirmedDate] = Date
.Update
lngContractID = [ContractID]
.Close
End With
I put the vbNullStrings in because not all fields on the original form may be filled in and so I thought that would handle the null values - my problem is that it won't work for the Date type.
So my question is, how do I manage a potential Null value on the Date field/type?
Of course, any other observations and recommendations would be most gratefully received!