I am receiving a Do While Syntax Error - Loop without Do - Can't See it. I would appreciate any fresh eyes?
Mary -
Private Sub Create_tblNJDOC()
-
-
-
On Error GoTo Err_Hndlr
-
-
Dim dbs As DAO.Database
-
Dim rstTemp As DAO.Recordset
-
Dim strSQL As String
-
-
'set variable values
-
Set dbs = CurrentDb
-
-
strSQL = "SELECT NJDOC.ProductName, " & _
-
"NJDOC.NDC_1, " & _
-
"NJDOC.GPI, " & _
-
"Count(NJDOC.Quantity) AS QuantitySummed, " & _
-
"Sum(NJDOC.[Amount Billed]) AS AmountBilledSummed, " & _
-
"Sum(NJDOC.AAC) AS SumOfAAC, Sum(NJDOC.BillFee) AS BillFeeSummed, " & _
-
"Sum(NJDOC.[Cost Billed]) AS CostBilledSummed " & _
-
"FROM NJDOC " & _
-
"GROUP BY NJDOC.ProductName, " & _
-
"NJDOC.NDC_1, NJDOC.GPI " & _
-
"ORDER BY NJDOC.ProductName;"
-
-
-
-
'Delete temporary table
-
' DoCmd.RunSQL "DROP TABLE tblNJDOC;"
-
-
'Create temporary table
-
CurrentDb.Execute ("CREATE TABLE tblNJDOC(ProductName VARCHAR(125), " & _
-
"NDC_1 VARCHAR(75), " & _
-
"GPI integer, " & _
-
"QuantitySummed currency, " & _
-
"AmountBilledSummed currency, " & _
-
"BillFeeSummed currency, " & _
-
"CostBilledSummed currency)")
-
-
'Bind rstTemp to the temporary table
-
Set rstTemp = CurrentDb.OpenRecordset(strSQL, dbOpenDynaset)
-
Set rstSummary = CurrentDb.OpenRecordset("tblNJDOC")
-
-
-
'*********temp fields for writing records
-
Dim strProductName_TEMP As String
-
Dim strNDC_1_TEMP As String
-
Dim strGPI_TEMP As Integer
-
Dim strQuantitySummed_TEMP As Integer
-
Dim strAmountBilledSummed_TEMP As Integer
-
Dim strBillFeeSummed_TEMP As Integer
-
Dim strCostBilledSummed_TEMP As Integer
-
-
Dim strNDC_1_Stack As String
-
-
-
strFirstRec = "Yes"
-
-
-
'Move the data into the temporary table
-
-
rstTemp.MoveFirst
-
-
Do While rstTemp.EOF = False
-
' ***************************************************
-
' first record flag
-
' ***************************************************
-
If strFirstRec = "Yes" Then
-
strFirstRec = "No"
-
strProductName_TEMP = rstTemp!ProductName
-
strNDC_1_TEMP = rstTemp!NDC_1
-
strGPI_TEMP = rstTemp!GPI
-
strQuantitySummed_TEMP = rstTemp!QuantitySummed
-
strAmountBilledSummed_TEMP = rstTemp!AmountBilledSummed
-
strBillFeeSummed_TEMP = rstTemp!BillFeeSummed
-
strCostBilledSummed_TEMP = rstTemp!CostBilledSummed
-
End If
-
-
If rstTemp!ProductName = strstrProductName_TEMP Then
-
If rstTemp!NDC_1 = strNDC_1_TEMP Then
-
strNDC_1_Stack = strNDC_1_TEMP
-
Else
-
strNDC_1_Stack = strNDC_1_Stack + "/ " + rstTemp!NDC_1
-
rstTemp!NDC_1 = strNDC_1_TEMP
-
End If
-
Else
-
' Write temp records to table
-
rstTemp.AddNew
-
rstSummary!ProductName = strProductName_TEMP
-
rstSummary!NDC_1 = strNDC_1_Stack
-
rstSummary!GPI = strGPI_TEMP
-
rstSummary!QuantitySummed = strQuantitySummed_TEMP
-
rstSummary!AmountBilledSummed = strAmountBilledSummed_TEMP
-
rstSummary!BillFeeSummed = strBillFeeSummed_TEMP
-
rstSummary!CostBilledSummed = strCostBilledSummed_TEMP
-
rstTemp.Update
-
-
' Move rst (record set) into the temp fields
-
-
strProductName_TEMP = rstTemp!ProductName
-
strNDC_1_TEMP = rstTemp!NDC_1
-
strGPI_TEMP = rstTemp!GPI
-
strQuantitySummed_TEMP = rstTemp!QuantitySummed
-
strAmountBilledSummed_TEMP = rstTemp!AmountBilledSummed
-
strBillFeeSummed_TEMP = rstTemp!BillFeeSummed
-
strCostBilledSummed_TEMP = rstTemp!CostBilledSummed
-
' move to next record set (rst)
-
-
rstTemp.MoveNext
-
Loop
-
-
' write last record
-
rstSummary.AddNew
-
rstSummary!ProductName = strProductName_TEMP
-
rstSummary!NDC_1 = strNDC_1_Stack
-
rstSummary!GPI = strGPI_TEMP
-
rstSummary!QuantitySummed = strQuantitySummed_TEMP
-
rstSummary!AmountBilledSummed = strAmountBilledSummed_TEMP
-
rstSummary!BillFeeSummed = strBillFeeSummed_TEMP
-
rstSummary!CostBilledSummed = strCostBilledSummed_TEMP
-
rstSummary.Update
-
-
rstTemp.Close
-
rstSummary.Close
-
-
-
Create_tblNJDOC_Exit:
-
Exit Sub
-
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "Create_tblNJDOC()"
-
-
End Sub
-
You are missing an End If. Just after line 108.
3 2797
You are missing an End If. Just after line 108.
Yes, thanks i found it after. it should have been line 107.
thanks FRESH EYES.
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.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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'
|
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()?
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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,...
|
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...
| |