Results 1 to 2 of 2

Thread: Another 2 questions...

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Location
    Melbourne
    Posts
    7

    Question

    1) I'm trying to cycle through all the TextBoxes in my form. This does not seem to work. Where did I go wrong?

    Dim mtxt as TextBox
    For Each mtxt In Me.Controls
    mtxt.Enabled = True
    Next mtxt


    2) I'm having trouble figuring out the ADO find function:
    Find (criteria, SkipRows, searchDirection, start)

    I more or less worked out criteria, but can someone please give me an example of how to use the other parameters? I can't seem to find one anywhere. My code as it stands:

    Private Sub cboAgentCode_Change()
    On Error GoTo NotFoundErr
    Dim x As String
    x = "intAgentCode = " & cboAgentCode.Text
    datAgent.Recordset.Find (x)

    Exit Sub
    NotFoundErr:
    MsgBox Err.Description
    End Sub

    Problem is, it works just fine if I cycle through the recordset using the ADO control itself. However, if I were to use the ComboBox to select a record which is earlier than the current record, an error would occur, I'm guessing because at the moment, it only searches one way.

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    'an example of going throught textboxes
    Code:
    'clear all textboxs on all forms or all textboxes on a single form
    '
    Option Explicit
    '
    Public Sub ClearTxt()
    '
    'mycontrol = control and increment is increment for forms
    'some situtations use more than one form.
    '
    	Dim ctlMyControl As Control
    	Dim intIncrement As Integer
    '
        	For intIncrement = 0 To Forms.Count - 1
            	For Each ctlMyControl In Forms(intIncrement).Controls
    '
       	If TypeOf ctlMyControl Is TextBox Then
    '
          		ctlMyControl.Text = ""
    '
       	End If
    '
            Next ctlMyControl
    '
                Next intIncrement
    '
    End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

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



Click Here to Expand Forum to Full Width