Solved

Memo fields in vb6 DataEnvironment....

Posted on 1999-01-29
4
706 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

932 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now