Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2003
    Posts
    228

    Unanswered: Dlookup and rich textbox controls

    How do you populate a rich textbox?

    I have the data stored in a table (is that a bad idea, storing RTF formated text in my table?) but I cannot populate a RTF control using dlookup?


    If Not IsNull(DLookup("[MoreInfo]", "tblAgencyInfo", "[Agency ID] = " & AgID)) Then
    Me.rtb = DLookup("[MoreInfo]", "tblAgencyInfo",
    "[Agency ID] = " & AgID)
    end if

  2. #2
    Join Date
    Feb 2002
    Posts
    403
    Me.rtb = DLookup("[MoreInfo]", "tblAgencyInfo",
    "[Agency ID] = " & AgID)

    Should probably be something like

    Me.rtb.RTFText = DLookup("[MoreInfo]", "tblAgencyInfo",
    "[Agency ID] = " & AgID)

    Have a look in your object browser under your rtf control and see what is listed for text.

  3. #3
    Join Date
    Sep 2003
    Posts
    228
    I tried the property you suggested before posting and it did not work either. I ended up saving to a text file and then loading that file into the field. That is the only thing I could get to work.

    Seems silly that I would have to create a file and then load it in. I will check again on your suggestion.

  4. #4
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    Why you don't use subform that show rtf-field??

  5. #5
    Join Date
    Sep 2003
    Posts
    228
    Could you expand on your idea? I am new.

    What I have is a Project form. This main form has a subform for Agencies (which is displayed in Continuous Form View). This Agency data has a catch all field that the user wants to type into and be able to format text colors. How could I use a subform on the agency subform to solve my problem?

  6. #6
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    Maybe I didn't understand what you are trying to do.
    Why you use Dlookup? Do you have Project, Agencies and rtf-tables?

    Could you send your db?

  7. #7
    Join Date
    Sep 2003
    Posts
    228
    I have a project table and an agency table. Within the agency table is a field called, "more info". There isn't enough room for a huge memo field on my subform so I put a "button" on the form which when clicked would display the "more info" field which is the field I need tied to rich textbox so the user can color code their entries.

  8. #8
    Join Date
    Sep 2002
    Location
    Finland
    Posts
    34
    Create new form and put there your rtf-field and recordsourse = agency-table. Change your button to open that new table witht criteria.

    Sample:
    Private Sub Button_Click()
    Dim stForm As String
    Dim stFilter As String

    stForm = "CTLITMTXTUPD10"
    stFilter = " CTLITMIDT = '" & Me![CTLLNEUPD12].Form![CTLITMIDT] & "'"

    If IsLoaded(stForm) Then
    DoCmd.Close acForm, stForm
    Else
    DoCmd.OpenForm stForm, acNormal, , stFilter, , acWindowNormal
    End If

    End Sub


    '' when you move one record to other you
    '' must reopen (get right data) form if it is open.
    ''
    Private Sub Form_Current()
    On Error GoTo Err_Form_Current
    Dim stForm As String
    Dim stFilter As String

    stForm = "CTLITMTXTUPD10"
    stFilter = "CTLITMIDT = '" & Me.CTLITMIDT & "'"

    If IsLoaded(stForm) Then
    DoCmd.OpenForm stForm, acNormal, , stFilter, , acWindowNormal
    End If

    Exit_Form_Current:
    Exit Sub

    Err_Form_Current:
    DoCmd.Close acForm, "CTLITMTXTUPD10", acSavePrompt
    Resume Exit_Form_Current

    End Sub


    Function IsLoaded(ByVal strFormName As String) As Integer

    Const conObjStateClosed = 0
    Const conDesignView = 0

    If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
    If Forms(strFormName).CurrentView <> conDesignView Then
    IsLoaded = True
    End If
    End If

    End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •