Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2004
    Posts
    59

    Unanswered: VBA in Access 2003

    I'm having trouble writing some VBA in Access 2003. Normally if I'm writing If statment's in VBA that need to check conditions on textbox I'd write something like this

    If (txtBoxName.Text) <> "condition" then
    ' do something
    Else:
    ' do something else
    End If

    This had always worked in VBA for Access 2000 but I'm getting Run-time errors with Access 2003. So, I've found that I can also write the following code now in Access 2003:

    If (txtboxname.value) <> "condition" then
    'do something
    Else:
    'do something else
    end if

    My problem is this. I get the runtime errors (can't access referenced control...) if I use the .text function... and sometimes by .Value command is returning a value of "" even though there is text entered...

    Any ideas on why this is coming back Null, even though there is data in the textbox?

    Best Regards!
    -Matt H-
    www.comperfection.com

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    If you use the .Text property, the focus must be set to that text box.
    Did you try
    PHP Code:
       If (txtBoxName.Text) <> "condition" Then
        
    ' do something
      Else:
        ' 
    do something else
      
    End If 

Posting Permissions

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