Hi,
In the following code, i keep getting a data conversion error at the fund field. In the code below, it takes data from a query and creates a table. It is a six digit alpha field within the query and within the created table. it bombs out on this line when writing the field: -
rstSummary!fund = strTempFund
-
This below is the procedure.
Any guidance would be appreciated. -
Private Sub Create_tbl_IDT_High_Level()
-
-
On Error GoTo Err_Hndlr
-
-
'*****************************************************************************************
-
' This sub routine builds a table
-
'
-
'******************************************************************************************
-
-
strFirstRec = "Yes"
-
-
' **** initialize temporary fields, date is set to dummy initial date, it has no meaning
-
-
-
strTempSeqNumber = 0
-
strTempIndexOrg = 0
-
strTempFund = " "
-
strTempAccountCode = 0
-
strTempTotalPrice = 0
-
strTempInd = " "
-
strTempRuleCode = " "
-
strTempSalesOrder = " "
-
strTemp_d_AccumativePrice = 0
-
strTemp_c_AccumativePrice = 0
-
Dim tbl_IDT As DAO.TableDef
-
Dim idxSeqNumber As DAO.Index
-
-
-
-
'**** create output table
-
'Delete temporary table
-
DoCmd.RunSQL "DROP TABLE tbl_IDT_High_Level;"
-
-
'Create temporary table
-
CurrentDb.Execute ("CREATE TABLE tbl_IDT_High_Level(SeqNumber smallint, IndexOrg Integer, " & _
-
"Fund VARCHAR(6), " & _
-
"AccountCode Integer, " & _
-
"TotalPrice money, " & _
-
"Ind VARCHAR(1), " & _
-
"RuleCode VARCHAR(4), " & _
-
"SalesOrder VARCHAR(8))")
-
-
-
' DoCmd.RunSQL "CREATE INDEX idxSeqNumber ON tbl_IDT (SeqNumber) WITH PRIMARY"
-
-
-
'Bind rstTemp to the temporary table
-
Set rstTemp = CurrentDb.OpenRecordset("sql_IDT_RPT_Step03_Format")
-
Set rstSummary = CurrentDb.OpenRecordset("tbl_IDT_High_Level")
-
-
-
rstTemp.MoveFirst
-
-
Do While rstTemp.EOF = False
-
-
-
-
' ***************************************************
-
' first record flag
-
' ***************************************************
-
-
If strFirstRec = "Yes" Then
-
strFirstRec = "No"
-
End If
-
strTempSeqNumber = strTempSeqNumber + 1
-
-
strTempIndexOrg = rstTemp!IndexOrg
-
strTempFund = rstTemp!fund
-
strTempAccountCode = rstTemp!AccountCode
-
strTempTotalPrice = rstTemp!TotalPrice
-
strTempInd = rstTemp!Ind
-
strTempRuleCode = rstTemp!RuleCode
-
strTempSalesOrder = rstTemp!SalesOrder
-
-
-
-
rstSummary.AddNew
-
rstSummary!SeqNumber = strTempSeqNumber
-
rstSummary!IndexOrg = strTempIndexOrg
-
rstSummary!fund = strTempFund
-
rstSummary!AccountCode = strTempAccountCode
-
rstSummary!TotalPrice = strTempTotalPrice
-
rstSummary!Ind = strTempInd
-
rstSummary!RuleCode = strTempRuleCode
-
rstSummary!SalesOrder = strTempSalesOrder
-
rstSummary.UPDATE
-
-
' Get Accummulative Totals
-
If strTempInd = "D" Then
-
strTemp_d_AccumativePrice = strTemp_d_AccumativePrice + strTempTotalPrice
-
Else
-
strTemp_c_AccumativePrice = strTemp_c_AccumativePrice + strTempTotalPrice
-
End If
-
-
Debug.Print "Start******************: ";
-
Debug.Print pvbNewLine
-
Debug.Print "strTemp_D_AccumativePrice: "; strTemp_d_AccumativePrice;
-
Debug.Print pvbNewLine
-
Debug.Print "strTemp_c_AccumativePrice: "; strTemp_c_AccumativePrice;
-
Debug.Print "end******************: ";
-
Debug.Print pvbNewLine
-
-
strTempIndexOrg = 0
-
strTempFund = " "
-
strTempAccountCode = 0
-
strTempTotalPrice = 0
-
strTempInd = " "
-
strTempRuleCode = " "
-
strTempSalesOrder = " "
-
-
rstTemp.MoveNext
-
Loop
-
-
'*** write accumative recordst record
-
If strTemp_d_AccumativePrice > 0 Then
-
strTempSeqNumber = strTempSeqNumber + 1
-
strTempIndexOrg = Null
-
strTempFund = "UK0000"
-
strTempAccountCode = 111101
-
strTempTotalPrice = strTemp_d_AccumativePrice
-
strTempInd = "C"
-
strTempRuleCode = "J099"
-
-
rstSummary.AddNew
-
rstSummary!SeqNumber = strTempSeqNumber
-
rstSummary!IndexOrg = strTempIndexOrg
-
rstSummary!fund = strTempFund
-
rstSummary!AccountCode = strTempAccountCode
-
rstSummary!TotalPrice = strTempTotalPrice
-
rstSummary!Ind = strTempInd
-
rstSummary!RuleCode = strTempRuleCode
-
rstSummary!SalesOrder = strTempSalesOrder
-
rstSummary.UPDATE
-
End If
-
-
If strTemp_c_AccumativePrice > 0 Then
-
strTempSeqNumber = strTempSeqNumber + 1
-
strTempIndexOrg = " "
-
strTempFund = "UK0000"
-
strTempAccountCode = 111101
-
strTempTotalPrice = strTemp_c_AccumativePrice
-
strTempInd = "D"
-
strTempRuleCode = "J099"
-
-
rstSummary.AddNew
-
rstSummary!SeqNumber = strTempSeqNumber
-
rstSummary!IndexOrg = strTempIndexOrg
-
rstSummary!fund = strTempFund
-
rstSummary!AccountCode = strTempAccountCode
-
rstSummary!TotalPrice = strTempTotalPrice
-
rstSummary!Ind = strTempInd
-
rstSummary!RuleCode = strTempRuleCode
-
rstSummary!SalesOrder = strTempSalesOrder
-
rstSummary.UPDATE
-
End If
-
-
rstTemp.Close
-
rstSummary.Close
-
Create_tbl_IDT_High_Level_Exit:
-
Exit Sub
-
-
-
Err_Hndlr:
-
-
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "Create_tbl_IDT_High_Level()"
-
End Sub
-
I'm a little confused since you state that rstTemp is Bound to the Temporary Table, but isn't rstSummary? - 'Bind rstTemp to the temporary table
-
Set rstTemp = CurrentDb.OpenRecordset("sql_IDT_RPT_Step03_Format")
-
Set rstSummary = CurrentDb.OpenRecordset("tbl_IDT_High_Level")
What is the definition of: - sql_IDT_RPT_Step03_Format
2 2058
I'm a little confused since you state that rstTemp is Bound to the Temporary Table, but isn't rstSummary? - 'Bind rstTemp to the temporary table
-
Set rstTemp = CurrentDb.OpenRecordset("sql_IDT_RPT_Step03_Format")
-
Set rstSummary = CurrentDb.OpenRecordset("tbl_IDT_High_Level")
What is the definition of: - sql_IDT_RPT_Step03_Format
Good morning,
rstTemp isn't a temp table, i forgot to delete that comment. Hot dog, :D, got it thank you...fund was converted to binary.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: New MSSQL DBA |
last post by:
Hi all, we are now planning to upgrade our application from a
non-unicode version to a unicode version. The application's backend is
a SQL Server 2000 SP3.
The concern is, existing business...
|
by: Balaji Neelakantan Pooruli |
last post by:
Hi,
We were in need of altering a DB2 table in which one of the column
has been changed from VARCHAR(256) to INTEGER. I have extracted the
table data into a tape before alters. After the alters...
|
by: Tu Quach |
last post by:
I got error message like "run time error 3421: data type conversion error"
how can i fix the trouble like that, any references should i include in ?
any help would be great
thank you
|
by: al |
last post by:
Dim dbParam_amount As System.Data.IDataParameter = New
System.Data.SqlClient.SqlParameter
dbParam_amount.ParameterName = "@amount"
dbParam_amount.Value = amount.text
dbParam_amount.DbType =...
|
by: Ecohouse |
last post by:
I have a field in a recordset which is a string. It can look like
this: 13-15-67-56
I need to break out this string into numbers to run in queries to open
recordsets.
But when I try to open...
|
by: Reggie |
last post by:
Hi and TIA. I have a dataset that I fill from an Access table. Some
integer and date fields are null. I'm iterating through the records and
sending them to an SQL database table. The problem...
|
by: SAL |
last post by:
I'm sorry if this has been answered before but I didn't see it in a quick
scan of the list.
The following code is causing an error when the field is null:
Error text:
Conversion from type...
|
by: girl |
last post by:
Hi i have a problem with MS SQL server 2000 and hope to seek for some advise.
i have the following samples
aa|0|abcdefg|
b|0|abcdefg|
i used the bulk insert in the query analyser..
BULK...
|
by: Javilen |
last post by:
Hello,
edit: added some more info
I am trying to set up a job to run a SSIS package in SQL 2005, the SQL 2005 is installed on a Windows server 2003 machine.
start Edit
I have the...
|
by: shalskedar |
last post by:
I want to transfer the excel data to th Db ..thru the VBA code.
In the DB there is a table called outer2 containing 1 of the columns as "Upvc" whose format is set to Long integer.
When i try to...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
| |