@ItsMe

Originally Posted by
ItsMe
@Steve
Why do you use parenthesis and quotes to define your field name? Is it because you are using SQL? Just curious and trying to understand something I am not familiar with.
Very good question..... I would have to say it is a style thing?? Or depends on my mood???
There are several ways to refer to a field in a recordset.
If I had two recordsets open and was adding a record to recordset 2 using AddNew, I might use:
Code:
With rs2
.AddNew
!AddDate = rs1!StartDate
!Field_FK = rs1!rs1_PK
.Update
End With
If using an SQL insert statement, I might use:
Code:
sSQL = "INSERT INTO tblMaster (AddDate, Field_FK) VALUES (#" & rs1("StartDate") & "#, " & rs1("rs1_PK") & ");"
Currentdb.Execute sSQL
Recordset fields can be refered to using:
Code:
rs1.Fields("AddDate")
rs1.Fields(0)
rs1!Fields("AddDate")
rs1!rs1_PK
rs1("AddDate")
I've used all five forms at different times. If I am modifying someone else's code, I try and follow how they refer to fields.