I have a one to many relationship between "cases" and "casenotes". Wherever there "casenotes.flagger = true" I want to mark "cases.manflag = true"
My problem comes when I want to mark "cases.manflag = false" where there are no instances of...
I don't understand.
The fields of "flagger" and "manflag" are both of the data type "bit", so if you set flagger or manflag to -1, the database will accept that as a "true", and if you set either fields to "0" then the database will accept is as...
it does not accept the words 'true' or 'false', but it will accept any single digit. It sees a -1 as true, and 0 as false.
I tried putting the space in regardless, and I still get a wrong data type error.
well, I tried it before I sent my last message - I get that error after I changed the "true" and "false" to "-1" and "0"
I get "incorrect syntax near the keyword 'then'".
I had to replace "True" and "false" with their integer values: (-1 = true and 0 = false if I remember correctly)
cnn.Execute ("Update cases SET cases.manflag = -1 when casenotes.flagger = -1 then -1 else 0...
sorry for the confusion - I also need to mark the proper record as true when there is a match, so your examples do work for that purpose. Thanks.
Can you help me with the problem of setting cases.manflag = false where there is no record in casenotes where flagger = true?
...record "manflag = false".
Here is my code for that:
cnn.Execute ("Update cases SET cases.manflag = 0 FROM cases, casenotes WHERE cases.caid = casenotes.caid and (select count (*) from cases, casenotes where cases.caid = casenotes.caid and casenotes.flagger = 1) = 0")
...record as "manflag=true". My code is listed below.
cnn.Execute ("Update cases SET cases.manflag = 'true' FROM cases, casenotes WHERE cases.caid = casenotes.caid and (select count (*) from cases, casenotes where cases.caid = casenotes.caid and casenotes.flagger = 'true') >...
Woo Hoo!
Tnks much, it all works now. For the record, this is the line that worked:
cnn.Execute ("Update cases SET cases.flag = 0 WHERE cases.casestatus = 1 and DateDiff(""hh"" ,[datein] ,Getdate()) >" & threshold)
Thanks very much.
Great! This worked!
I'm getting an error with the execute query though:
"'h' is not a recognized datediff option"
I tried putting only one set of quotes around the "h" but then it says: "expected: list separator or )"
p.s.
I've been working on this for the past month so your help is greatly appreciated. I created about 6 pages of code as an alternate solution, but it is unstable.
strCnn = "Server=Hal9000;Database=Client3;Trusted_Connection=yes"
This string did not work - I get the error:
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.
'The following five lines work...
Private Sub cmbjump_AfterUpdate()
searcher = (Nz(Me![cmbjump], 0)) 'cmbjump is a combo box
searched = "[cid]" '[CID] is the primary key
jumpsearch 'jumpsearch is a function which I listed below.
End Sub
'But these five lines don't (Arguments are of...
Thanks! Please be merciful with this next mundane question. About this line:
"Data Source=<yoursource;Initial Catalog=dbname;" & _
"User Id=<user>;Password=<pasword>;"
I cannot seem to be putting the right data in. I have an sql server running on a computer with this...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.