Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax error on update

Status
Not open for further replies.

case81

Programmer
Jan 10, 2002
23
IE
hey all,

sorry to bother yis, i'm getting a syntax error in an update here's the code:

rsteamstoday.open sqlstr,dbcon

While rsTeamsToday.EOF = False
chkdate = rsTeamsToday.Fields("datecreated")
If Day(chkdate) = Day(today) And Month(chkdate) = Month(today) And Year(today) = Year(chkdate) Then
TeamsDayCnt = TeamsDayCnt + 1
tid = rsTeamsToday.Fields("team_id")


***** dbcon1.Execute ("UPDATE teams SET day='yes' WHERE team_id=" & tid) *****

End If
rsTeamsToday.MoveNext

Wend

the dbcon1.execute gives me the error, and when i highlight it, it reads as : (UPDATE teams set day='ye..."UPDATE teams SET day='yes' WHERE team_id=45")


????

any help is very much appreciated,

thanks guys
 
Are you sure day is a varchar (SQL Server) field or text (Access) field? Because if it is a bit or boolean or yes/no, then you do not want to pass through 'yes'. instead you want to say :
Code:
dbcon1.Execute ("UPDATE teams SET day=true WHERE team_id=" & tid)

That's the only thing I can see wrong.

Kevin
 
case,
Is the field "team_id" in your database a text field? (It may contain "numeric text" i.e. "45", and still be text data type. If it is, you will need to put quotes around the value in tid in your WHERE clause. Like so:

tid = "'" & rsTeamsToday.Fields("team_id") & "'"

Just a thought.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top