Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Memo fields in vb6 DataEnvironment....

Posted on 1999-01-29
4
Medium Priority
?
771 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 90 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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 …
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

963 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