Re: sql update script
- From: eric <eric@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 3 May 2006 14:08:01 -0700
Hi Douglas,
Thank you for helping me out again (Albert thank you again for responding in
first instance). Thanks for your advice about (not)storing the score. Be sure
I appreciate your help on that matter later on.
The goodworking script you gave me I put (under a button) in VB like this:
Private Sub cmdButton_Click()
Dim dbs As Database
Dim strSQL As String
strSQL = " UPDATE tblTable" & _
" SET tblTable.A_score = " & _
" IIf(tblTable.A_result=[A_rightanswer], 1, 0) "
dbs.Execute strSQL , dbFailOnError
End Sub
And again, as earlier, I get "error 91 => objectvariable or block(?)variable
With not started", with dbs.Execute... highlighted.
Yet the script looks so much like simulair scripts I saw on the discgroup.
Can you help me out on this ?
greetings
--
eric
"Douglas J Steele" wrote:
UPDATE tblTable SET tblTable.A_score =.
IIf(tblTable.A_result=[A_rightanswer], 1, 0)
However, I wouldn't recommend storing the score in the table at all.
Creating a query that includes a calculated field to do that, and use the
query wherever you would otherwise have used the table.
--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)
"eric" <eric@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CD505E42-5B79-4BC9-9033-7B92F9F96071@xxxxxxxxxxxxxxxx
Hi Albert,errormessages.
Thank you for responding
Perhaps it's possible you guide me a little further on this matter ?
As a reaction to your response I started from scratch building an
Updatequery (is that the correct English term for this type of query?)
I made:
UPDATE tblTable SET tblTable.A_score = 1
WHERE (((tblTable.A_result)=[A_rightanswer]));
and tested it => works fine
So now I have => where result = rightanswer => score = 1
Now in the same update I want: where result <> rightanswer => score = 0
I tried to put it somehow in the above update, but I only got
Can you lead me further on this ?works....Once
Thank you in advance
--
eric
"Albert D.Kallal" wrote:
Can you paste the sql into a query..and run it?
It sounds to me like you have the wrong table name....
Build the query in the query builder..and work on it until it
theyou get that working..then you can switch into view mode, and look at
point....sql. You can even cut/paste that sql into your code as a starting
So, check the table name.....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@xxxxxxx
http://www.members.shaw.ca/AlbertKallal
- Follow-Ups:
- Re: sql update script
- From: Douglas J Steele
- Re: sql update script
- References:
- Re: sql update script
- From: Albert D.Kallal
- Re: sql update script
- From: Douglas J Steele
- Re: sql update script
- Prev by Date: Re: how to writing form value back to a field in a table ?.
- Next by Date: Re: Duplicating tabs
- Previous by thread: Re: sql update script
- Next by thread: Re: sql update script
- Index(es):
Loading