473,473 Members | 2,286 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

ADODB Update Problem

devonknows
137 New Member
I was wondering if anyone could help me on this, im having trouble with the last elseif, for some reason when i try and use MEMO in the access database it only lets me put in like 20 characters or something so im having to put in 3 description boxes in the database to allow me to put in 750 characters, but when im trying to split the text up i can get
Expand|Select|Wrap|Line Numbers
  1.                 If Len(Text4.Text) <= 250 Then
  2.                     rs!Description = Text4.Text
  3.                     rs!Description2 = ""
  4.                     rs!Description3 = ""
  5.                 ElseIf Len(Text4.Text) > 250 And Len(Text4.Text) <= 500 Then
  6.                     rs!Description = Left(Text4.Text, 250)
  7.                     rs!Description2 = Right(Text4.Text, Len(Text4.Text) - 250)
  8.                     rs!Description3 = ""
  9.  
to work but when i try and add the 2nd elseif it just keeps crashing on me

Expand|Select|Wrap|Line Numbers
  1.                 ElseIf Len(Text4.Text) > 500 And Len(Text4.Text) <= 750 Then
  2.                     rs!Description = Left(Text4.Text, 250)
  3.                     rs!Description2 = Right(Text4.Text, Len(Text4.Text) - 250)
  4.                     rs!Description3 = Right(Text4.Text, Len(Text4.Text) - 500)
  5.                 End If
  6.  
If anyone can show me a better way of doing this then i would be most greatful or tell me how to make the memo section on the access database accept more than a few characters, i always beleived that a memo field was unlimited in characters or something... a full view of the desciption code is below if anyone could help i would be most greatful

Kind Regards as always
Devon.

Expand|Select|Wrap|Line Numbers
  1.         Do While Not rs.EOF
  2.             If rs!filmname = Label7.Caption And rs!cdnumber = Label5.Caption And _
  3.             rs!filmgenre = Label9.Caption And rs!filmtype = Label11.Caption Then
  4.                 rs!cdnumber = Text2.Text
  5.                 rs!filmname = Text3.Text
  6.                 rs!filmgenre = Combo1.Text
  7.                 rs!filmtype = Combo2.Text
  8.                 rs!filmrating = Text6.Text
  9.                 rs!dateadded = Text7.Text
  10.                 If Len(Text4.Text) <= 250 Then
  11.                     rs!Description = Text4.Text
  12.                     rs!Description2 = ""
  13.                     rs!Description3 = ""
  14.                 ElseIf Len(Text4.Text) > 250 And Len(Text4.Text) <= 500 Then
  15.                     rs!Description = Left(Text4.Text, 250)
  16.                     rs!Description2 = Right(Text4.Text, Len(Text4.Text) - 250)
  17.                     rs!Description3 = ""
  18.                 ElseIf Len(Text4.Text) > 500 And Len(Text4.Text) <= 750 Then
  19.                     rs!Description = Left(Text4.Text, 250)
  20.                     rs!Description2 = Right(Text4.Text, Len(Text4.Text) - 250)
  21.                     rs!Description3 = Right(Text4.Text, Len(Text4.Text) - 500)
  22.                 End If
  23.                  rs.Update
  24.             End If
  25.  
Mar 9 '07 #1
5 2074
vijaydiwakar
579 Contributor
I was wondering if anyone could help me on this, im having trouble with the last elseif, for some reason when i try and use MEMO in the access database it only lets me put in like 20 characters or something so im having to put in 3 description boxes in the database to allow me to put in 750 characters, but when im trying to split the text up i can get
Expand|Select|Wrap|Line Numbers
  1.                 If Len(Text4.Text) <= 250 Then
  2.                     rs!Description = Text4.Text
  3.                     rs!Description2 = ""
  4.                     rs!Description3 = ""
  5.                 ElseIf Len(Text4.Text) > 250 And Len(Text4.Text) <= 500 Then
  6.                     rs!Description = Left(Text4.Text, 250)
  7.                     rs!Description2 = Right(Text4.Text, Len(Text4.Text) - 250)
  8.                     rs!Description3 = ""
  9.  
to work but when i try and add the 2nd elseif it just keeps crashing on me

Expand|Select|Wrap|Line Numbers
  1.                 ElseIf Len(Text4.Text) > 500 And Len(Text4.Text) <= 750 Then
  2.                     rs!Description = Left(Text4.Text, 250)
  3.                     rs!Description2 = Right(Text4.Text, Len(Text4.Text) - 250)
  4.                     rs!Description3 = Right(Text4.Text, Len(Text4.Text) - 500)
  5.                 End If
  6.  
If anyone can show me a better way of doing this then i would be most greatful or tell me how to make the memo section on the access database accept more than a few characters, i always beleived that a memo field was unlimited in characters or something... a full view of the desciption code is below if anyone could help i would be most greatful

Kind Regards as always
Devon.

Expand|Select|Wrap|Line Numbers
  1.         Do While Not rs.EOF
  2.             If rs!filmname = Label7.Caption And rs!cdnumber = Label5.Caption And _
  3.             rs!filmgenre = Label9.Caption And rs!filmtype = Label11.Caption Then
  4.                 rs!cdnumber = Text2.Text
  5.                 rs!filmname = Text3.Text
  6.                 rs!filmgenre = Combo1.Text
  7.                 rs!filmtype = Combo2.Text
  8.                 rs!filmrating = Text6.Text
  9.                 rs!dateadded = Text7.Text
  10.                 If Len(Text4.Text) <= 250 Then
  11.                     rs!Description = Text4.Text
  12.                     rs!Description2 = ""
  13.                     rs!Description3 = ""
  14.                 ElseIf Len(Text4.Text) > 250 And Len(Text4.Text) <= 500 Then
  15.                     rs!Description = Left(Text4.Text, 250)
  16.                     rs!Description2 = Right(Text4.Text, Len(Text4.Text) - 250)
  17.                     rs!Description3 = ""
  18.                 ElseIf Len(Text4.Text) > 500 And Len(Text4.Text) <= 750 Then
  19.                     rs!Description = Left(Text4.Text, 250)
  20.                     rs!Description2 = Right(Text4.Text, Len(Text4.Text) - 250)
  21.                     rs!Description3 = Right(Text4.Text, Len(Text4.Text) - 500)
  22.                 End If
  23.                  rs.Update
  24.             End If
  25.  
there is a problem in memo that it can accept only first line i.e. whenevr it encounters vbcrlf then it leaves remaining value so try to use the code
Expand|Select|Wrap|Line Numbers
  1.  
  2. Conn.Execute "insert into temp(ff) values('" & Replace(Text1.Text, vbCrLf, "##") & "')"
  3.  
where conn is thy connection (ADODB) ff is memo filed in temp tbl
here i'm replacing vbcrlf with ## so the large value can be inserted without vbcrlf
whenevr u 'll retriuve this value just replace ## with vbcrlf and thy problem will be get solved
u need not to use three decription fileds
Try it
Good Luck
Mar 10 '07 #2
devonknows
137 New Member
Im afraid that its not working, ive tried it but its still only allowing a total of 50 characters into it, the text is mainly on one line anyway as it is a description field of a film, sometimes enter is pressed to give space but not often, but anything i try to enter in the Microsoft Access database under memo only allows me 50 chars, here the connection string im using.

Expand|Select|Wrap|Line Numbers
  1.         Set rs = New ADODB.Recordset
  2.         rs.Open Source:="filmdatabase", _
  3.             ActiveConnection:=conn, _
  4.             CursorType:=adOpenDynamic, _
  5.             LockType:=adLockOptimistic
  6.         Do While Not rs.EOF
  7.             If rs!filmname = Label7.Caption And rs!cdnumber = Label5.Caption And _
  8.             rs!filmgenre = Label9.Caption And rs!filmtype = Label11.Caption Then
  9.                 rs!cdnumber = Text2.Text
  10.                 rs!filmname = Text3.Text
  11.                 rs!filmgenre = Combo1.Text
  12.                 rs!filmtype = Combo2.Text
  13.                 rs!filmrating = Text6.Text
  14.                 rs!dateadded = Text7.Text
  15.                 rs!maindescription = Replace(Text4.Text, vbCrLf, "##")
  16.                 rs.Update
  17.             End If
  18.  
  19.             rs.MoveNext
  20.         Loop
  21.  
ive replaced the Description, Description2, Description3 with maindescription (maindescription is the memo field) any help as always will be greatly appreciated.

Kind Regards
Devon
Mar 10 '07 #3
vijaydiwakar
579 Contributor
Im afraid that its not working, ive tried it but its still only allowing a total of 50 characters into it, the text is mainly on one line anyway as it is a description field of a film, sometimes enter is pressed to give space but not often, but anything i try to enter in the Microsoft Access database under memo only allows me 50 chars, here the connection string im using.

Expand|Select|Wrap|Line Numbers
  1.         Set rs = New ADODB.Recordset
  2.         rs.Open Source:="filmdatabase", _
  3.             ActiveConnection:=conn, _
  4.             CursorType:=adOpenDynamic, _
  5.             LockType:=adLockOptimistic
  6.         Do While Not rs.EOF
  7.             If rs!filmname = Label7.Caption And rs!cdnumber = Label5.Caption And _
  8.             rs!filmgenre = Label9.Caption And rs!filmtype = Label11.Caption Then
  9.                 rs!cdnumber = Text2.Text
  10.                 rs!filmname = Text3.Text
  11.                 rs!filmgenre = Combo1.Text
  12.                 rs!filmtype = Combo2.Text
  13.                 rs!filmrating = Text6.Text
  14.                 rs!dateadded = Text7.Text
  15.                 rs!maindescription = Replace(Text4.Text, vbCrLf, "##")
  16.                 rs.Update
  17.             End If
  18.  
  19.             rs.MoveNext
  20.         Loop
  21.  
ive replaced the Description, Description2, Description3 with maindescription (maindescription is the memo field) any help as always will be greatly appreciated.

Kind Regards
Devon
see i've checked this code on more than 200 chars with vbcrlf as line seperetor and its working fine
Mar 12 '07 #4
vijaydiwakar
579 Contributor
see i've checked this code on more than 200 chars with vbcrlf as line seperetor and its working fine
try to use connection object as i've given in example
Mar 12 '07 #5
devonknows
137 New Member
But the problem being im not inserting, im updating and you have to use a different type of connection, plus ive even tried to use visdata to manually edit the field and even in visdata it doesnt let me go over 50 characters, the insert into clause isnt required here that is why im using rs!update, would it be worth using another database type or instead of using ADODB ? i only use it as its the only one i know how to use. And there isnt so much a vbcrlf as line seperator, its mainly one line of text in a text box wordwrapped.


Apologies for being a pain
Kind Regards
Devon.
Mar 13 '07 #6

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

Similar topics

13
by: Patrick | last post by:
I understand that with IIS5.1 on Windows XP Professional SP1, I can 1) Either set under IIS Manager-> Any specific Virtual Directory-> Configuration->Options->ASP Script timeout for all pages...
0
by: elcc1958 | last post by:
I need to support a VB6 application that will be receiving disconnected ADODB.Recordset from out DotNet solution. Our dotnet solution deals with System.Data.DataTable. I need to populate a...
0
by: Channing Jones | last post by:
Hello everyone, I am trying to store data in a binary field of an SQL-Server table using ADODB. So far, I have managed to store a record but not any data in the binary field. I only get...
1
by: pramodrepaka | last post by:
i am not able to add records with the help of ADODB. what is the problem i am not able to understand please help me. this is the code i written In General Declaration Dim cn As New...
0
by: dmckenna | last post by:
I've been tasked to upgrade an old system and there's many different versions of VB code that uses MDAC to talk to MSSql. Do you know what the difference is between the two code versions? Is there...
3
by: mark_aok | last post by:
Hi all, All I am trying to do is open a table, edit it, and then close it. But I am having the strangest error. Here is my code Dim i as integer Dim rs as adodb.recordset Set rs = new...
0
by: PCroser | last post by:
I have encountered a problem when querying a table. The query passed data into a recordset which should have resulted in many records but has returned EOF. After debugging the code the only...
1
by: sphinney | last post by:
All, I have a ADODB.Recordset in my Access 2002 project. I've been able to successfully add fields to the record set. According the the MS Access help files, I now must update the recordset to...
10
by: chuckzter | last post by:
Hey guys, I would like to know how to replace values in your database via ADODB. Example: (I would want to replace the value LOCATION of ID 1001 which is Oliver to Laguna.) ID NAME...
2
bmallett
by: bmallett | last post by:
I am getting the following error: Error Type: ADODB.Command (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another....
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
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...
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,...
1
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...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.