Hi All
First off, let me say thanks for any advice or help you can provide with this problem. So I’m a bit confused with whats going on right now. I have two sets of tables that I need to run a DCOUNT routine (VBA) on and I am at a loss why the second one isn’t working programmatically.
The first command works fine (in this case the field TRIPID is a number, and the table is called SPECIES_02_03). Please drop me a line if you need all the code..
cmd.CommandText = "UPDATE ANALYSIS SET NMBR_TRP = DCount(""*"",""SPECIES_02_03"",""TRIPID="" & [TRIPID]);".
The problem is when I have to do something similar on the other table (OBSPP) where the field LINK1 is a string it doesn’t work programmatically.
cmd.CommandText = "UPDATE Analysis SET NMBR_TRP = DCount(""*"",""OBSPP"",""LINK1='"" & [LINK1] & "" '"")"
I was initially thinking that I might have screwed up somewhere feeding in the double quotes or something along those lines. However, if I put a break in the code and extract what cmd.commandtext is I get the code below. When I cut and past that into a standalone query in Access it works perfectly.
UPDATE Analysis SET NMBR_TRP = DCount("*","OBSPP","LINK1='" & [LINK1] & " '")
Any suggestions would be greatly appreciated since I’m at a bit of a loss in regards to why this sql snippet isn’t working programmatically but is working in Access.
Thanks
-eric
First off, let me say thanks for any advice or help you can provide with this problem. So I’m a bit confused with whats going on right now. I have two sets of tables that I need to run a DCOUNT routine (VBA) on and I am at a loss why the second one isn’t working programmatically.
The first command works fine (in this case the field TRIPID is a number, and the table is called SPECIES_02_03). Please drop me a line if you need all the code..
cmd.CommandText = "UPDATE ANALYSIS SET NMBR_TRP = DCount(""*"",""SPECIES_02_03"",""TRIPID="" & [TRIPID]);".
The problem is when I have to do something similar on the other table (OBSPP) where the field LINK1 is a string it doesn’t work programmatically.
cmd.CommandText = "UPDATE Analysis SET NMBR_TRP = DCount(""*"",""OBSPP"",""LINK1='"" & [LINK1] & "" '"")"
I was initially thinking that I might have screwed up somewhere feeding in the double quotes or something along those lines. However, if I put a break in the code and extract what cmd.commandtext is I get the code below. When I cut and past that into a standalone query in Access it works perfectly.
UPDATE Analysis SET NMBR_TRP = DCount("*","OBSPP","LINK1='" & [LINK1] & " '")
Any suggestions would be greatly appreciated since I’m at a bit of a loss in regards to why this sql snippet isn’t working programmatically but is working in Access.
Thanks
-eric