Trouble spanning lines

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

Guest

Hello,
I'm having trouble spanning lines for a docmd.runsql statement. Here's a
snippet of my code (there are several more fields to update, so the "SET"
keeps going on...and on... and on):

DoCmd.RunSQL ("UPDATE [MEC Demographics], [MEC Data] INNER JOIN qryLimitData
ON [MEC Data].[Sequelae GBD Code] = qryLimitData.[Sequelae GBD Code] SET [MEC
Data].[Population Incidence Males 0-4] = qryLimitData![Incidence Males
0-4]*[MEC Demographics]![Males 0-4]/100000, [MEC Data].[Population Incidence
Males 5-14] = qryLimitData![Incidence Males 5-14]*[MEC Demographics]![Males
5-14]/100000")

If I try to break that (or the full-length version) up using underscores, I
get an "Error: expected list separator or )".
 
Try this out:

DoCmd.RunSQL "UPDATE [MEC Demographics], [MEC Data] INNER JOIN qryLimitData"
& _
ON [MEC Data].[Sequelae GBD Code] = qryLimitData.[Sequelae GBD Code] SET [MEC
" & _
Data].[Population Incidence Males 0-4] = qryLimitData![Incidence Males " & _
"0-4]*[MEC Demographics]![Males 0-4]/100000, [MEC Data].[Population Incidence
" & _
"Males 5-14] = qryLimitData![Incidence Males 5-14]*[MEC Demographics]![Males
" & _
"5-14]/100000"

I put spaces at the end of every line, so some of your filed names might not
be right, but this should give you the general idea.

Also, unless you are calling a function and assigning its result, you do not
need to use parenthesis.

Gina
Hello,
I'm having trouble spanning lines for a docmd.runsql statement. Here's a
snippet of my code (there are several more fields to update, so the "SET"
keeps going on...and on... and on):

DoCmd.RunSQL ("UPDATE [MEC Demographics], [MEC Data] INNER JOIN qryLimitData
ON [MEC Data].[Sequelae GBD Code] = qryLimitData.[Sequelae GBD Code] SET [MEC
Data].[Population Incidence Males 0-4] = qryLimitData![Incidence Males
0-4]*[MEC Demographics]![Males 0-4]/100000, [MEC Data].[Population Incidence
Males 5-14] = qryLimitData![Incidence Males 5-14]*[MEC Demographics]![Males
5-14]/100000")

If I try to break that (or the full-length version) up using underscores, I
get an "Error: expected list separator or )".
 
Bingo!! Thank you.

Gina via AccessMonster.com said:
Try this out:

DoCmd.RunSQL "UPDATE [MEC Demographics], [MEC Data] INNER JOIN qryLimitData"
& _
ON [MEC Data].[Sequelae GBD Code] = qryLimitData.[Sequelae GBD Code] SET [MEC
" & _
Data].[Population Incidence Males 0-4] = qryLimitData![Incidence Males " & _
"0-4]*[MEC Demographics]![Males 0-4]/100000, [MEC Data].[Population Incidence
" & _
"Males 5-14] = qryLimitData![Incidence Males 5-14]*[MEC Demographics]![Males
" & _
"5-14]/100000"

I put spaces at the end of every line, so some of your filed names might not
be right, but this should give you the general idea.

Also, unless you are calling a function and assigning its result, you do not
need to use parenthesis.

Gina
Hello,
I'm having trouble spanning lines for a docmd.runsql statement. Here's a
snippet of my code (there are several more fields to update, so the "SET"
keeps going on...and on... and on):

DoCmd.RunSQL ("UPDATE [MEC Demographics], [MEC Data] INNER JOIN qryLimitData
ON [MEC Data].[Sequelae GBD Code] = qryLimitData.[Sequelae GBD Code] SET [MEC
Data].[Population Incidence Males 0-4] = qryLimitData![Incidence Males
0-4]*[MEC Demographics]![Males 0-4]/100000, [MEC Data].[Population Incidence
Males 5-14] = qryLimitData![Incidence Males 5-14]*[MEC Demographics]![Males
5-14]/100000")

If I try to break that (or the full-length version) up using underscores, I
get an "Error: expected list separator or )".
 
Back
Top