Solved

Memo fields in vb6 DataEnvironment....

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

706 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

14 Experts available now in Live!

Get 1:1 Help Now