Results 1 to 2 of 2

Thread: Run Script When Form Loads?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    I have created a database in Access and want to run a script/macro/event (in access - not vb) or whatever you want to call it, to see if a paticular value is true or false and if true pop up a messgae box.

    Thanks in advance,

    DocZaf
    {¦->

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655

    Thumbs up

    Here is an example:
    Create a table
    Add a Field called "Food", make the data type "Text"
    Add a Field called "Good?", make the datatype "Yes/No"
    Make it's format "True/False"
    Save the table ("Table1" works fine)
    Let Access assign a primary key or don't, it matters not.
    Add a Form
    Use the wizard, add all fields, and follow the steps.
    Go into design view for the form
    Make the "CheckBox" for "Good?" invisible.
    Set it's name to "Good"
    Place a command button on the form right over the
    check box
    Call it "CheckGood"
    Right click on it, select "Event Builder"
    Select "Code Builder"
    Add the following code
    Code:
    Private Sub CheckGood_Click()
    Dim TF
    TF = Good.Value
    If TF = -1 Then
    MsgBox "It was good food!"
    Else
    MsgBox "It was nasty food!"
    End If
    End Sub
    That's it. Save the form and the database, add some information to the table through another form or through the table itself and then to test it, display the form we just made and filter through the record and click the CheckGood button to see whether the food you ate was good or not.

    (Ok, it's a cheesy example, but it should help you out.)

    Let me know if you need more help.


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