Solved

Memo fields in vb6 DataEnvironment....

Posted on 1999-01-29
4
718 Views
Last Modified: 2013-12-25
Anyone have code to updade, insert and select from a table with a memo field(access db) in VB6 DataEnvironment and ADOVB.....

thanx in advance,
MG
0
Comment
Question by:mguedes
4 Comments
 
LVL 2

Expert Comment

by:cjwik
ID: 1499626
look at appenchunck
0
 
LVL 1

Expert Comment

by:MAD012999
ID: 1499627
You will need to setup an ODBC 'System DSN' to open the ADO connection.  Below is a simple ASP example using VBScript - is it adequate?  You will need to modify the CreateObject syntax to remove the Server.

Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.ConnectionTimeout = 60
DataConn.CommandTimeout = 60
DataConn.Open "DSN=SystemDSNName;", "OptionalUser", "OptionalPassword"

Set rsMain = DataConn.Execute("Select * from ""TableName""",,1)
do while not rsMain.EOF
   TempValue = rsMain("FieldName")
loop
DataConn.Close

I hope this helps and Good Luck,
Mike
0
 
LVL 4

Accepted Solution

by:
agarwal_rahul earned 30 total points
ID: 1499628
Here is a code to load & save an rtf file in a text field. It uses RDO but with little modification it should work with ADO.

Private Sub cmdLoad_Click()
    Dim strSQL      As String
    Dim strChunk    As String
    Dim lngPos      As Long
    Dim lngColSize  As Long
    Dim intFileHnd  As Integer
   
    mrsetText.Requery
    mrsetText.MoveFirst
    txtTextDesc.Text = mrsetText("TEXT_DESC").Value
    lngColSize = mrsetText("TEXT").ColumnSize
       
    intFileHnd = FreeFile()
   
    Open App.Path & "\Try.Rtf" For Append As #intFileHnd
    For lngPos = 1 To lngColSize
        Print #intFileHnd, mrsetText("TEXT").GetChunk(CHUNK_SIZE)
        lngPos = lngPos + (CHUNK_SIZE - 1)
    Next lngPos
    Close intFileHnd
   
    rtbText.LoadFile App.Path & "\Try.Rtf", rtfRTF
    rtbText.Refresh
   
    Kill App.Path & "\Try.Rtf"
End Sub

Private Sub cmdSave_Click()
    On Error GoTo ErrorHandler
   
    Dim strSQL      As String
    Dim strChunk    As String
    Dim strNewItmID As String
   
    Dim lngPos      As Long
    Dim rsetAddNew  As rdoResultset
       
    gDB.QueryTimeOut = 0
       
    strNewItmID = GetNewKey("ITEM_ID")
   
    strSQL = "SELECT * FROM TEXT WHERE 1 = 2"
    gDB.OpenRecordset rsetAddNew, strSQL, rdOpenKeyset, rdConcurValues

    rsetAddNew.ActiveConnection.BeginTrans
        rsetAddNew.AddNew
        rsetAddNew("ITEM_ID").Value = strNewItmID
        rsetAddNew("TEXT_DESC").Value = txtTextDesc.Text
        rsetAddNew("TEXT").AppendChunk Null
       
        For lngPos = 1 To Len(rtbText.TextRTF)
            rsetAddNew("TEXT_DESC").Value = "UPD"
            strChunk = ""
            strChunk = Mid$(rtbText.TextRTF, lngPos, CHUNK_SIZE)
            rsetAddNew("TEXT").AppendChunk strChunk
               
            lngPos = lngPos + (CHUNK_SIZE - 1)
            DoEvents
        Next lngPos
       
        rsetAddNew.Update
    rsetAddNew.ActiveConnection.CommitTrans
   
    rsetAddNew.Close
    Set rsetAddNew = Nothing
   
    Exit Sub
   
ErrorHandler:
    rsetAddNew.ActiveConnection.RollbackTrans
    Call DBError_Log("DB Error", "cmdSave_Click()")
End Sub

0
 

Author Comment

by:mguedes
ID: 1499629
thank´s for your help
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question