Running code in a Form

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Hrusovszky

    Running code in a Form

    I have not been able to figure out how to run code in a form, before any
    buttons are pushed/clicked. What I have is a recipe manager that "reads" an
    access file to get recipe information. When a user first goes into it, they
    should be displayed the 1st recipe in the database, but I am unsure how to
    do this. I believe I can get that information if they click a button on the
    form with the proper database read commands, but how do I tell VB to go
    ahead and get that information for the 1st record BEFORE they click on
    anything at all?



  • Larry Serflaten

    #2
    Re: Running code in a Form


    "John Hrusovszky" <jayjay76@wctc. net> wrote[color=blue]
    > I have not been able to figure out how to run code in a form, before any
    > buttons are pushed/clicked. What I have is a recipe manager that "reads" an
    > access file to get recipe information. When a user first goes into it, they
    > should be displayed the 1st recipe in the database, but I am unsure how to
    > do this. I believe I can get that information if they click a button on the
    > form with the proper database read commands, but how do I tell VB to go
    > ahead and get that information for the 1st record BEFORE they click on
    > anything at all?[/color]


    the Form_Load event happens before the form is shown. Perhaps
    you can use that....

    LFS




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

    Comment

    • Rick Rothstein

      #3
      Re: Running code in a Form

      > I have not been able to figure out how to run code in a form, before any[color=blue]
      > buttons are pushed/clicked. What I have is a recipe manager that "reads"[/color]
      an[color=blue]
      > access file to get recipe information. When a user first goes into it,[/color]
      they[color=blue]
      > should be displayed the 1st recipe in the database, but I am unsure how to
      > do this. I believe I can get that information if they click a button on[/color]
      the[color=blue]
      > form with the proper database read commands, but how do I tell VB to go
      > ahead and get that information for the 1st record BEFORE they click on
      > anything at all?[/color]

      Are you saying you don't know about the Form_Load and/or Form_Activate
      events, or are you having a different kind of problem?

      Rick - MVP


      Comment

      • John Hrusovszky

        #4
        Re: Running code in a Form

        Sorry for being trivial in this, but I am new to VB -- please bear with me
        during my learning.
        If there is a more basic VB newsgroup, I'd be happy to post these sort of
        questions there, as
        I only want to learn how to code properly.


        I load my "View Recipes Form" from my "Main Menu Form" with a:

        Private Sub cmdViewRecipe_C lick()
        frmViewRecipe.S how
        Unload frmMainMenu
        End Sub

        Are you saying I should read the 1st item of the database inside this
        command like:

        Private Sub cmdViewRecipe_C lick()
        frmViewRecipe.S how
        Data1.RecordSet .Movefirst
        Unload frmMainMenu
        End Sub

        (the Data will appear then in the View Recipe form?)
        And, if that is the case, Data1 being the name of my Data Control Object ...
        I need to figure
        out what that is as well -- what exactly a Data Control Object is as I am
        not finding where to
        actually "set" what that is.





        "Rick Rothstein" <rickNOSPAMnews @NOSPAMcomcast. net> wrote in message
        news:vcadnaCk8t EwaubdRVn-hA@comcast.com. ..[color=blue][color=green]
        > > I have not been able to figure out how to run code in a form, before any
        > > buttons are pushed/clicked. What I have is a recipe manager that[/color][/color]
        "reads"[color=blue]
        > an[color=green]
        > > access file to get recipe information. When a user first goes into it,[/color]
        > they[color=green]
        > > should be displayed the 1st recipe in the database, but I am unsure how[/color][/color]
        to[color=blue][color=green]
        > > do this. I believe I can get that information if they click a button on[/color]
        > the[color=green]
        > > form with the proper database read commands, but how do I tell VB to go
        > > ahead and get that information for the 1st record BEFORE they click on
        > > anything at all?[/color]
        >
        > Are you saying you don't know about the Form_Load and/or Form_Activate
        > events, or are you having a different kind of problem?
        >
        > Rick - MVP
        >
        >[/color]


        Comment

        Working...