I would have expected it to fail on numeric fields as well.
You'll have to check the field type, then, before assigning the value:
If rsFinal.Fields(fld.Name).Type = dbDate Then
RsFinal(fld.Name) = Nz(RsTemp(fld.Name), 0)
Else
RsFinal(fld.Name) = Nz(RsTemp(fld.Name), "")
End If
although, more correctly, it should probably be:
Select Case rsFinal.Fields(fld.Name).Type
Case dbText, dbMemo
RsFinal(fld.Name) = Nz(RsTemp(fld.Name), "")
Case Else
RsFinal(fld.Name) = Nz(RsTemp(fld.Name), 0)
End Select

Signature
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
> The problem is occuring at the line:
>
[quoted text clipped - 51 lines]
> > >> > Null
> > >> > into the blank text field and bombs out. what's going on?
David C. Holley - 29 Aug 2005 14:09 GMT
How many records do you have in the RsTemp table/query? If you have more
than 1 record, on which record does the code crap out?
> I would have expected it to fail on numeric fields as well.
>
[quoted text clipped - 15 lines]
> RsFinal(fld.Name) = Nz(RsTemp(fld.Name), 0)
> End Select
jsccorps - 30 Aug 2005 02:31 GMT
DC Holley: There may be hundreds of records that I will be appending.
DJ Steele et al: the following works (not elegant - but it works). Also,
setting the date to zero gives me 12/30/1899. How can I make the date blank?
Do Until RsTemp.EOF
RsFinal.AddNew
For Each fld In RsFinal.Fields
If fld.Type = dbText Or fld.Type = dbMemo Then
RsFinal(fld.Name) = Nz(RsTemp(fld.Name), "")
ElseIf fld.Type = dbDate Then
RsFinal(fld.Name) = Nz(RsTemp(fld.Name), 0) ' when blank,
sets date to 12/30/1899
Else
RsFinal(fld.Name) = Nz(RsTemp(fld.Name))
End If
Next fld
RsFinal.Update
RsTemp.MoveNext
Loop
> I would have expected it to fail on numeric fields as well.
>
[quoted text clipped - 76 lines]
> > > >> > Null
> > > >> > into the blank text field and bombs out. what's going on?
David C. Holley - 30 Aug 2005 04:20 GMT
Insert an If...then to check if the code is on the field for the Date
within the If...then test for 0 and override it to Null as in
If fld.Name = "date" then
If rsTemp(fld.name) = 0 then
rsFinal(fld.Name) = Null
else
rsFinal(fld.name) = rsTemp(fld.Name)
end if
end if
> DC Holley: There may be hundreds of records that I will be appending.
>
[quoted text clipped - 107 lines]
>>>>>>>Null
>>>>>>>into the blank text field and bombs out. what's going on?
jsccorps - 02 Sep 2005 21:14 GMT
Thanks everyone. The following code (for date) works:
If fld.Type = dbDate Then
If IsNull(rsTemp(fld.Name)) = True Then
rsFinal(fld.Name) = Null
Else
rsFinal(fld.Name) = rsTemp(fld.Name)
End If
End If
> Insert an If...then to check if the code is on the field for the Date
> within the If...then test for 0 and override it to Null as in
[quoted text clipped - 118 lines]
> >>>>>>>Null
> >>>>>>>into the blank text field and bombs out. what's going on?