Link to home
Start Free TrialLog in
Avatar of pcalabria
pcalabriaFlag for United States of America

asked on

Unable to write to text box in MS Access 2K

Hello Experts, I'm using Access 2K on a windows xp professional sp3 platform.

Wow... this problem is driving me crazy.  I wrote code to display how long an event takes and then display the time in a text box called txtETime on  a form called
Forms!frmcaptureworldinventory.  

The code seems to calculated the elapsed time correctly, but will not display it in the text box.  Nothing is displayed, not even an error message.

I was totally confused, so I created a second text box on the form, and ran the code again, written below. The code below only displays the result in the text box called: etime

I need to display the code in the txtETime textbox as this box is used by other routines, which have no trouble!

Code:

Private Sub Capture_Click()

    Dim dteStartTime As Date
   
    On Error GoTo Error_Routine
   
    dteStartTime = Now
   
    Call ClearCapture
   
    Forms!frmcaptureworldinventory.txtETime = DateDiff("s", dteStartTime, Now) & " seconds"
    Forms!frmcaptureworldinventory.etime = DateDiff("s", dteStartTime, Now) & " seconds"
   
   
Exit Sub

Error_Routine:
      MsgBox Err.Description
End Sub
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If that doesn't help, try these syntactical variations to rule out conflicts in your naming conventions:

Forms!frmcaptureworldinventory.Controls("txtETime") = DateDiff("s", dteStartTime, Now) & " seconds"

Open in new window


Forms!frmcaptureworldinventory!txtETime = DateDiff("s", dteStartTime, Now) & " seconds"

Open in new window

Hi,

If the above is still an issue please post the code for the  sub ClearCapture

Thanks,

Bill
Avatar of pcalabria

ASKER

Recreating the text box did it!
Thanks