473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Do While Syntax Error - Loop without Do - Can't See it?

133 100+
I am receiving a Do While Syntax Error - Loop without Do - Can't See it. I would appreciate any fresh eyes?

Mary

Expand|Select|Wrap|Line Numbers
  1. Private Sub Create_tblNJDOC()
  2.  
  3.  
  4. On Error GoTo Err_Hndlr
  5.  
  6. Dim dbs As DAO.Database
  7. Dim rstTemp As DAO.Recordset
  8. Dim strSQL As String
  9.  
  10. 'set variable values
  11. Set dbs = CurrentDb
  12.  
  13. strSQL = "SELECT NJDOC.ProductName, " & _
  14.                 "NJDOC.NDC_1, " & _
  15.                 "NJDOC.GPI, " & _
  16.                 "Count(NJDOC.Quantity) AS QuantitySummed, " & _
  17.                 "Sum(NJDOC.[Amount Billed]) AS AmountBilledSummed, " & _
  18.                 "Sum(NJDOC.AAC) AS SumOfAAC, Sum(NJDOC.BillFee) AS BillFeeSummed, " & _
  19.                 "Sum(NJDOC.[Cost Billed]) AS CostBilledSummed " & _
  20.         "FROM NJDOC " & _
  21.         "GROUP BY NJDOC.ProductName, " & _
  22.                 "NJDOC.NDC_1, NJDOC.GPI " & _
  23.         "ORDER BY NJDOC.ProductName;"
  24.  
  25.  
  26.  
  27. 'Delete temporary table
  28. ' DoCmd.RunSQL "DROP TABLE tblNJDOC;"
  29.  
  30. 'Create temporary table
  31. CurrentDb.Execute ("CREATE TABLE tblNJDOC(ProductName VARCHAR(125), " & _
  32.                 "NDC_1 VARCHAR(75), " & _
  33.                 "GPI integer, " & _
  34.                 "QuantitySummed currency, " & _
  35.                 "AmountBilledSummed currency, " & _
  36.                 "BillFeeSummed currency, " & _
  37.                 "CostBilledSummed currency)")
  38.  
  39. 'Bind rstTemp to the temporary table
  40. Set rstTemp = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
  41. Set rstSummary = CurrentDb.OpenRecordset("tblNJDOC")
  42.  
  43.  
  44.  '*********temp fields for writing records
  45. Dim strProductName_TEMP As String
  46. Dim strNDC_1_TEMP As String
  47. Dim strGPI_TEMP As Integer
  48. Dim strQuantitySummed_TEMP As Integer
  49. Dim strAmountBilledSummed_TEMP As Integer
  50. Dim strBillFeeSummed_TEMP As Integer
  51. Dim strCostBilledSummed_TEMP As Integer
  52.  
  53. Dim strNDC_1_Stack As String
  54.  
  55.  
  56. strFirstRec = "Yes"
  57.  
  58.  
  59. 'Move the data into the temporary table
  60.  
  61. rstTemp.MoveFirst
  62.  
  63. Do While rstTemp.EOF = False
  64.     ' ***************************************************
  65.     ' first record flag
  66.     ' ***************************************************
  67.     If strFirstRec = "Yes" Then
  68.         strFirstRec = "No"
  69.         strProductName_TEMP = rstTemp!ProductName
  70.         strNDC_1_TEMP = rstTemp!NDC_1
  71.         strGPI_TEMP = rstTemp!GPI
  72.         strQuantitySummed_TEMP = rstTemp!QuantitySummed
  73.         strAmountBilledSummed_TEMP = rstTemp!AmountBilledSummed
  74.         strBillFeeSummed_TEMP = rstTemp!BillFeeSummed
  75.         strCostBilledSummed_TEMP = rstTemp!CostBilledSummed
  76.      End If
  77.  
  78.     If rstTemp!ProductName = strstrProductName_TEMP Then
  79.         If rstTemp!NDC_1 = strNDC_1_TEMP Then
  80.             strNDC_1_Stack = strNDC_1_TEMP
  81.         Else
  82.             strNDC_1_Stack = strNDC_1_Stack + "/ " + rstTemp!NDC_1
  83.             rstTemp!NDC_1 = strNDC_1_TEMP
  84.         End If
  85.     Else
  86.       ' Write temp records to table
  87.         rstTemp.AddNew
  88.             rstSummary!ProductName = strProductName_TEMP
  89.             rstSummary!NDC_1 = strNDC_1_Stack
  90.             rstSummary!GPI = strGPI_TEMP
  91.             rstSummary!QuantitySummed = strQuantitySummed_TEMP
  92.             rstSummary!AmountBilledSummed = strAmountBilledSummed_TEMP
  93.             rstSummary!BillFeeSummed = strBillFeeSummed_TEMP
  94.             rstSummary!CostBilledSummed = strCostBilledSummed_TEMP
  95.         rstTemp.Update
  96.  
  97.         ' Move rst (record set) into the temp fields
  98.  
  99.         strProductName_TEMP = rstTemp!ProductName
  100.         strNDC_1_TEMP = rstTemp!NDC_1
  101.         strGPI_TEMP = rstTemp!GPI
  102.         strQuantitySummed_TEMP = rstTemp!QuantitySummed
  103.         strAmountBilledSummed_TEMP = rstTemp!AmountBilledSummed
  104.         strBillFeeSummed_TEMP = rstTemp!BillFeeSummed
  105.         strCostBilledSummed_TEMP = rstTemp!CostBilledSummed
  106.         ' move to next record set (rst)
  107.  
  108.         rstTemp.MoveNext
  109. Loop
  110.  
  111. ' write last record
  112.         rstSummary.AddNew
  113.             rstSummary!ProductName = strProductName_TEMP
  114.             rstSummary!NDC_1 = strNDC_1_Stack
  115.             rstSummary!GPI = strGPI_TEMP
  116.             rstSummary!QuantitySummed = strQuantitySummed_TEMP
  117.             rstSummary!AmountBilledSummed = strAmountBilledSummed_TEMP
  118.             rstSummary!BillFeeSummed = strBillFeeSummed_TEMP
  119.             rstSummary!CostBilledSummed = strCostBilledSummed_TEMP
  120.         rstSummary.Update
  121.  
  122. rstTemp.Close
  123. rstSummary.Close
  124.  
  125.  
  126. Create_tblNJDOC_Exit:
  127.   Exit Sub
  128.  
  129.  
  130. Err_Hndlr:
  131.     MsgBox "[" & Err.Number & "]:  " & Err.Description, vbInformation, "Create_tblNJDOC()"
  132.  
  133. End Sub
  134.  
Oct 12 '10 #1

✓ answered by Mariostg

You are missing an End If. Just after line 108.

3 2797
Mariostg
332 100+
You are missing an End If. Just after line 108.
Oct 12 '10 #2
dowlingm815
133 100+
Yes, thanks i found it after. it should have been line 107.

thanks FRESH EYES.
Oct 12 '10 #3
NeoPa
32,556 Expert Mod 16PB
I'm pleased to see you got your problem solved, but next time, please include the line number the error occurred on. Especially if posting 133 lines of code.
Oct 12 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: NanQuan | last post by:
I'm hoping someone can help me solve this error since I am at a total loss here. Usually I don't bother posting on any forums or groups on the internet and prefer to solve stuff myself but this is...
1
by: Donald Canton | last post by:
Hi, I'm using Bjarne's book to learn C++ and am stuck on the Calc program in Section 6. Everything works fine except when I try to use istringstream to parse a token from the command line. I...
3
by: Jerry | last post by:
Well, here is some weirdness. First, I noticed that I have 2 Set keywords (silly me). so I removed the 2nd "Set" but still got a syntax error. Then I removed the Where clause, and now it works...
2
by: RogerInHawaii | last post by:
I would like to pass an array by reference to a function so that I can modify the contents of the array and effectively "return" that array to the caller. I tried doing this: function...
7
by: Dustin MacDonald | last post by:
Hi everyone. This is my first time posting to this newsgroup, and although I maintain my netiquette I might've missed something specific to the newsgroup, so hopefully you can avoid flaming me...
10
by: allik7 | last post by:
I am have a problem with this section of code. When I place the select statemnet in a string variable i get an syntax error at RTRIM. Can the Case section be used in a string variable i am wondering...
17
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
0
by: Stef Mientki | last post by:
hello, I've syntax error which I totally don't understand: ########## mainfile : import test_upframe2 if __name__ == '__main__': var1 = 33 code = 'print var1 + 3 \n'
0
by: Terry Reedy | last post by:
Stef Mientki wrote: Indendation is screwed. Is the above all do_more body? Which locals does this get you? __init__'s? (locals()?) Isn't this just the same as globals()?
2
by: GLEberts | last post by:
I can not seem to get rid of this syntax error - hope someone can help out. the error I am getting is: Run time Error 3075 Syntax error missing operator in query expression =name I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.