Old programmer needs help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Could you please tell me where I am going wrong in this basic sample code. I
am not sure how to add/append new data into a table

Dim rstRaceHeader As DAO.Recordset
Set rstRaceHeader = dbs.OpenRecordset("tblRaceHeader", dbOpenDynaset)

With rstRaceHeader
Race_Date = RaceDate
Total_Races = TotalRaces
End With

Race_Date and Total_Races are fields in tblRaceHeader. RaceDate and
TotalRaces are input fields and program checks correctly via MsgBox checks
throughout program. These are the variables which I want to append to the
table.
Thanks for taking the time to examine this simple problem but your input
will aid an old programmer
 
Erik T said:
Could you please tell me where I am going wrong in this basic sample
code. I am not sure how to add/append new data into a table

Dim rstRaceHeader As DAO.Recordset
Set rstRaceHeader = dbs.OpenRecordset("tblRaceHeader",
dbOpenDynaset)

With rstRaceHeader
Race_Date = RaceDate
Total_Races = TotalRaces
End With

Race_Date and Total_Races are fields in tblRaceHeader. RaceDate and
TotalRaces are input fields and program checks correctly via MsgBox
checks throughout program. These are the variables which I want to
append to the table.
Thanks for taking the time to examine this simple problem but your
input will aid an old programmer

See my answer to your original post of this question. There's no point
in posting again so soon, by the way.
 
Could you please tell me where I am going wrong in this basic sample code. I
am not sure how to add/append new data into a table

Dim rstRaceHeader As DAO.Recordset
Set rstRaceHeader = dbs.OpenRecordset("tblRaceHeader", dbOpenDynaset)

With rstRaceHeader
Race_Date = RaceDate
Total_Races = TotalRaces
End With

Race_Date and Total_Races are fields in tblRaceHeader. RaceDate and
TotalRaces are input fields and program checks correctly via MsgBox checks
throughout program. These are the variables which I want to append to the
table.
Thanks for taking the time to examine this simple problem but your input
will aid an old programmer


With rstRaceHeader
.AddNew
![Race_Date]= RaceDate
![Total_Races] = TotalRaces
.Update
End With

Set rstRceHeader = Nothing ' When you're done!



Richard
 
Thanks for the reply and sorry for the duplicate post. I received an error
message on the first posting and that is why I duplicated.
 
Erik T said:
Thanks for the reply and sorry for the duplicate post. I received an
error message on the first posting and that is why I duplicated.

That's been happening a lot in the last few weeks. I hope they get the
bugs in the web newsgroup interface worked out soon. Personally, I use
Outlook Express, rather then the web interface, to read news -- it's
much more efficient, and not subject to these problems.
 
Back
Top