473,725 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbie(ish) ASP/Access Problem

2 New Member
Would somebody please have a look at the following piece of code for me? It is supposed to write a single record to one table in a database and a group of related records to another table. It worked without any problems when I was using Access 97 and a "DRIVER={Micros oft Access Driver (*.mdb)}; DBQ=" & server.mappath( "/d1/d101.mdb") connection string. However, since upgrading to Access 2000 it is failing.

The error I get is:
Microsoft JET Database Engine (0x80040E57)
The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.
/u1/u20/u204.asp, line 78

I know for sure that none of the data exceeds field size and when I check the database manually, I find that the main record and the first of the subsidiary records have been written successfully but the rest have not, so it's obviously getting through the first iteration of the loop but failing on the second.

Any suggestions?

Btw, I'm pretty new to all this stuff so be gentle :)

Expand|Select|Wrap|Line Numbers
  1. 45 set adoConnect=server.createobject("ADODB.connection")
  2. 46 adoConnect.mode = 3
  3. 47 strDBLocation = server.mappath("/d1/d101_2000.mdb")
  4. 48 adoConnect.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & strDBLocation
  5. 49
  6. 50 strSQL="INSERT INTO D101a (HorseName,BirthYear,SireName,DamName,StOfOrig,"
  7. 51 strSQL=strSQL & "Colour,Sex,SW,GSW,Active,HasWins,EnteredBy)"
  8. 52 strSQL=strSQL & " VALUES "
  9. 53 strSQL=strSQL & "('" & Request.Form("UserHorseName") & "',"
  10. 54 strSQL=strSQL & Year(Now) - Request.Form("UserHorseAge") & ","
  11. 55 strSQL=strSQL & "'" & Request.Form("UserSireName") & "',"
  12. 56 strSQL=strSQL & "'" & Request.Form("UserDamName") & "',"
  13. 57 strSQL=strSQL & "'" & Request.Form("StOfOrig") & "',"
  14. 58 strSQL=strSQL & "'" & Request.Form("Colour") & "',"
  15. 59 strSQL=strSQL & "'" & Request.Form("Sex") & "',"
  16. 60 strSQL=strSQL & Request.Form("SW") & ","
  17. 61 strSQL=strSQL & Request.Form("GSW") & ","
  18. 62 strSQL=strSQL & Request.Form("Active") & ","
  19. 63 strSQL=strSQL & HasWins & ","
  20. 64 strSQL=strSQL & "'" & EnteredBy & "')"
  21. 65 adoConnect.execute strSQL
  22. 66
  23. 67 if HasWins then
  24. 68   dim index
  25. 69   for index = 1 to request.form("NumWins")
  26. 70     strSQL="INSERT INTO D101b (HorseName,BirthYear,RaceYear,RaceGrade,RaceDist,RaceSurf)"
  27. 71     strSQL=strSQL & " VALUES "
  28. 72     strSQL=strSQL & "('" & Request.Form("UserHorseName") & "',"
  29. 73     strSQL=strSQL & "'" & Year(Now) - Request.Form("UserHorseAge") & "',"
  30. 74     strSQL=strSQL & "'" & Request.Form("RaceYear" & index) & "',"
  31. 75     strSQL=strSQL & "'" & Request.Form("RaceGrade" & index) & "',"
  32. 76     strSQL=strSQL & "'" & Request.Form("RaceDist" & index) & "',"
  33. 77     strSQL=strSQL & "'" & Request.Form("RaceSurf" & index) & "')"
  34. 78     adoConnect.execute strSQL
  35. 79   next
  36. 80 end if
  37. 81 
  38. 82 adoConnect.close
  39. 83 set adoConnect = nothing
May 16 '07 #1
3 2129
ADezii
8,834 Recognized Expert Expert
Would somebody please have a look at the following piece of code for me? It is supposed to write a single record to one table in a database and a group of related records to another table. It worked without any problems when I was using Access 97 and a "DRIVER={Micros oft Access Driver (*.mdb)}; DBQ=" & server.mappath( "/d1/d101.mdb") connection string. However, since upgrading to Access 2000 it is failing.

The error I get is:
Microsoft JET Database Engine (0x80040E57)
The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.
/u1/u20/u204.asp, line 78

I know for sure that none of the data exceeds field size and when I check the database manually, I find that the main record and the first of the subsidiary records have been written successfully but the rest have not, so it's obviously getting through the first iteration of the loop but failing on the second.

Any suggestions?

Btw, I'm pretty new to all this stuff so be gentle :)

45 set adoConnect=serv er.createobject ("ADODB.connect ion")
46 adoConnect.mode = 3
47 strDBLocation = server.mappath( "/d1/d101_2000.mdb")
48 adoConnect.open "PROVIDER=MICRO SOFT.JET.OLEDB. 4.0;DATA SOURCE=" & strDBLocation
49
50 strSQL="INSERT INTO D101a (HorseName,Birt hYear,SireName, DamName,StOfOri g,"
51 strSQL=strSQL & "Colour,Sex,SW, GSW,Active,HasW ins,EnteredBy)"
52 strSQL=strSQL & " VALUES "
53 strSQL=strSQL & "('" & Request.Form("U serHorseName") & "',"
54 strSQL=strSQL & Year(Now) - Request.Form("U serHorseAge") & ","
55 strSQL=strSQL & "'" & Request.Form("U serSireName") & "',"
56 strSQL=strSQL & "'" & Request.Form("U serDamName") & "',"
57 strSQL=strSQL & "'" & Request.Form("S tOfOrig") & "',"
58 strSQL=strSQL & "'" & Request.Form("C olour") & "',"
59 strSQL=strSQL & "'" & Request.Form("S ex") & "',"
60 strSQL=strSQL & Request.Form("S W") & ","
61 strSQL=strSQL & Request.Form("G SW") & ","
62 strSQL=strSQL & Request.Form("A ctive") & ","
63 strSQL=strSQL & HasWins & ","
64 strSQL=strSQL & "'" & EnteredBy & "')"
65 adoConnect.exec ute strSQL
66
67 if HasWins then
68 dim index
69 for index = 1 to request.form("N umWins")
70 strSQL="INSERT INTO D101b (HorseName,Birt hYear,RaceYear, RaceGrade,RaceD ist,RaceSurf)"
71 strSQL=strSQL & " VALUES "
72 strSQL=strSQL & "('" & Request.Form("U serHorseName") & "',"
73 strSQL=strSQL & "'" & Year(Now) - Request.Form("U serHorseAge") & "',"
74 strSQL=strSQL & "'" & Request.Form("R aceYear" & index) & "',"
75 strSQL=strSQL & "'" & Request.Form("R aceGrade" & index) & "',"
76 strSQL=strSQL & "'" & Request.Form("R aceDist" & index) & "',"
77 strSQL=strSQL & "'" & Request.Form("R aceSurf" & index) & "')"
78 adoConnect.exec ute strSQL
79 next
80 end if
81
82 adoConnect.clos e
83 set adoConnect = nothing
One or more Fields that you are Appending Data to may be too small for the value. For instance, if you have the [Sex] Field in Table D101a defined as TEXT 1 (single character M or F), and try to append 'Male' to this Field, you will get this Error. Check all your Field sizes against the data to be appended.
May 17 '07 #2
Tom McQ
2 New Member
Thanks for taking the time to reply but unfortunately, it isn't invalid data that's causing the problem (I wish it was that simple). No, most of the input, like Sex etc, is controlled by dropdowns in an HTML form and in the few fields where the user is invited to type their own input, I've got decent validation routines in place to block out of range data. The problem lies elsewhere.

Not to worry though. As a temporary fix, I've gone back to my original Access 97 version which still works without problem.

Thanks again,
Tom.
May 18 '07 #3
nico5038
3,080 Recognized Expert Specialist
The Jet-engine has been rewritten for A2000 and higher versions, so the problem might be in the Jet-engine.
I would start with setting a breakpoint in the errorline and use the immediate window to print the strSQL like:
? strSQL
Then use the resulting string to paste in the target database in a new query.
Activate the query and see what message is triggered.

Nic;o)
May 19 '07 #4

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

Similar topics

1
1108
by: AkiMatti | last post by:
Hi! I'm making a form that has checkboxes and want to handle the checked checkboxes in code. The problem is that I don't know how to do it! Here is what I've tried so far: Private Sub cmd_update_Click() On Error GoTo Err_cmd_update_Click Dim rowsToUpdate As String If check_a.Value Then
1
1088
pdsterling
by: pdsterling | last post by:
BTW, I did read 15 pages of posts back, looking for similar problems. Problem No 2 is that I cannot seem to post announcements. I have looked all over to see if there is a switch that needs to be turned on or something. My announcements are translated into:
1
4679
by: wadacom | last post by:
I'm sorry to take your time for newbie problems but I've been searching what to do about the problem with my apache server I have. I work with ubuntu dapperdrake I put the last apache server on it and I tried to put the mod_python module to work. the only answer I got was that apache didn't find api structure in the module. afterwards I read I didn't need this module to work with python (only a speed difference as I understand) but the problem...
1
1034
by: ph23ms | last post by:
This is going to sound stupid, but I am totally new to Access and need help... I have 3 tables, one I am treating as a Master with Project ID set as the PK. I need 2 other tables to automatically create a new record when a new record is created in the Master table. I have a relationship set up (one to many) between the Master table Project ID field and the other 2 tables Project ID fields (not set to PK in 'sub' tables)... Any help with...
9
1473
by: John | last post by:
Hello all. I am a PHP newbie and am having an issue using the && in an if statement. here is the code: if ($_REQUEST == "1" && date("Y-m-d") < $rowWork) { die("<h1>The earlybird special has ended.</h1>"); }
0
1577
by: vippstar | last post by:
On Jun 28, 7:01 pm, tom <nos...@nospam.invalidwrote: Hi Yes. Just any advice or something in particular? Put your signature at the bottom of your post not in the middle. <snip code> There's your problem, intercharge is not defined anywhere. nor 'or'. (iso646.h is not included) <snip> 'Software' is not defined anywhere. <snip>
0
1129
by: Alan Silver | last post by:
Hello, I'm a newbie at PHP and MySql, although I have wads of experience of ASP, ASP.NET, SQL Server, etc. I have just installed PHP 5.2.3 on a server (Windows Server 2003), as well as MySql 5.0.45. Both of these work fine independently, but I can't get PHP to connect to MySql. The first (and probably most basic) problem is that when I run phpinfo()
22
3822
by: V S Rawat | last post by:
(bringing the discussion here for php.general) I am on xpsp3, wampserver 2.0, having apache 2.2.8, php 5.2.6, MySQL 5.0.51b. http://localhost/ is E:\wamp\www\ I have put the first php script to hello.php file: <html> <head> <title>PHP Test</title>
0
1717
by: Edwin.Madari | last post by:
-----Original Message----- statement prepared first and executed many times with exectemany - db API http://www.python.org/dev/peps/pep-0249/ inline statemets can be exeucuted only. hope that helps Edwin
0
8888
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9257
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9111
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4517
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.