Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

?Cant set TimerInterval to zero

ToniStorhannusToniStorhannus Member Posts: 6
Hello!
I have tried to make my Form to do once when it is loaded a macro which can get the actual number of the elements my query just gave to me.
It seams that every action By the form is taking plase too early for my action. So i should get timer to work.
I have set the value in the properties window and i have attend to set it to zero in my macro.
When the timer launches my macro which will make the conting operation and then it will set TimerIterval to zero.
But it does not set it. What could be done wrong?

These are the lines i have beentrying. The uppermost is the on that access has generated itself.
[Forms]![Tiedotlomake].[TimerInterval]=0
[Forms]![Tiedotlomake].[TimerInterval]='0'
[Forms]![Tiedotlomake].[TimerInterval]="0"

Thank you for advanse

Toni Storhannus

Comments

  • RikRik Member Posts: 56
    Hi

    I don't know how you can set the TimerInterval property in a macro, so i assume that you are calling
    [code]
    [Forms]![Tiedotlomake].[TimerInterval]=0
    [/code]
    from your Forms Form_Timer() event (in [b]code[/b]). But you seem to be doing the actual work in a [b]macro[/b]. You can't do both, it has to be either a macro that responds to the timer event, or code. So i suspect that your macro is being called only.

    You should replace your macros with VB code, and do everything in the Form_Timer() event. This will work:
    [code]
    Private Sub Form_Timer()
    Me.TimerInterval = 0 ' Form_Timer() will not get called again.

    ' ** Do your other stuff here **

    End Sub
    [/code]

    Remember to set your Forms On Timer property to [Event Procedure].

    I've used 'Me.TimerInterval = 0' instead of '[Forms]![Tiedotlomake].[TimerInterval]=0'. Because the code belongs to the form, you can use 'Me' instead of '[Forms]![Tiedotlomake]'. If you change the name of the form, you don't have to change the code:-).

    It's better to use VB code than macros, every time.

    One more thing: you say you are trying to get the number of records from a query when the form is loaded.

    If you set your Forms On Open property to [Event Procedure], you can use this code:
    [code]
    Private Sub Form_Open(Cancel As Integer)
    nRecords = Me.Recordset.RecordCount
    End Sub
    [/code]
    This will get the number of records for the Forms RecordSource.

    : Hello!
    : I have tried to make my Form to do once when it is loaded a macro which can get the actual number of the elements my query just gave to me.
    : It seams that every action By the form is taking plase too early for my action. So i should get timer to work.
    : I have set the value in the properties window and i have attend to set it to zero in my macro.
    : When the timer launches my macro which will make the conting operation and then it will set TimerIterval to zero.
    : But it does not set it. What could be done wrong?
    :
    : These are the lines i have beentrying. The uppermost is the on that access has generated itself.
    : [Forms]![Tiedotlomake].[TimerInterval]=0
    : [Forms]![Tiedotlomake].[TimerInterval]='0'
    : [Forms]![Tiedotlomake].[TimerInterval]="0"
    :
    : Thank you for advanse
    :
    : Toni Storhannus
    :

  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    __ ( http://forcoder.org ) free ebooks and video tutorials about { Python Java Assembly Ruby Visual Basic .NET Delphi Visual Basic MATLAB R C C# Perl Scratch C++ JavaScript Go PL/SQL Objective-C Swift PHP Clojure Ada Lisp Prolog Alice Lua Awk COBOL Hack Bash FoxPro F# VBScript Erlang ABAP Scala Transact-SQL Rust Dart SAS Crystal Apex Logo Julia ML D Fortran Kotlin Scheme LabVIEW } ___________

Sign In or Register to comment.