startup dialog box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to create a startup dialog box that users can read, and then
check a box that would prevent it from showing every other time they open the
database. Basically, I want it to be a kind of "First time use, get to know
the database" dialog box that they can read the first time they open the
database, and then if they don't want to read it each time, they can check a
box and it goes away everyother time they open the database. How would I go
about doing that? I read a post that will create the dialog box, but I don't
know about adding the check box.
 
I would like to create a startup dialog box that users can read, and then
check a box that would prevent it from showing every other time they open the
database. Basically, I want it to be a kind of "First time use, get to know
the database" dialog box that they can read the first time they open the
database, and then if they don't want to read it each time, they can check a
box and it goes away everyother time they open the database. How would I go
about doing that? I read a post that will create the dialog box, but I don't
know about adding the check box.

I'm assuming you've created your own form to do this?

If so, then add a table to your database, something like this:

tShowDialogs
-------------------------------
sFormName Text, 255 chars
sUserName Text, 50 chars
bShow Yes/No

Now, in the Unload or Close event of your dialog form, add code like this:

Sub Form_Unload()
If Me.NameOfYourCheckbox.Value = True Then
'/first remove any existing record for this form/user
Currentdb.Execute "DELETE * FROM tShowDialogs WHERE sFormName='" & Me.Name & "' AND sUserName='" & Currentuser & "'"
'/now add a new record
Currentdb.Execute "INSERT INTO tShowDialogs(sFormName, sUserName, bShow) VALUES('" & Me.Name & "','" & CurrentUser &
"'," & Me.YourCheckbox.Value & ")"
End If
End Sub

You'd need to change the name of YourCheckbox to match that of the control on your dialog form.

If you'd prefer not to always delete a record, then you could open a recordset agains tShowDialogs and check for the
existence of a record using the form name and CurrentUser in a WHERE clause, but I'd suspect that this would only be
done once for each user, so there's really little need to do this.


Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
I tried your code, but whenever I click on my close button on the form, I get
a "method or data member not found" error and it opens up VB. Here's the
code I'm using and I named the checkbox "NeverShow"

Private Sub Form_Close()
If Me.NeverShow.Value = True Then
'/first remove any existing record for this form/user
CurrentDb.Execute "DELETE * FROM tShowDialogs WHERE sFormName='" &
Me.Name & "' AND sUserName='" & CurrentUser & "'"
'/now add a new record
CurrentDb.Execute "INSERT INTO tShowDialogs(sFormName, sUserName, bShow)
VALUES('" & Me.Name & "','" & CurrentUser & "'," & Me.NeverShow.Value & ")"
End If

End Sub
 
I fixed it. However, after putting a check in the box and closing the
database, the form still shows up the next time I open the database.
 
I fixed it. However, after putting a check in the box and closing the
database, the form still shows up the next time I open the database.

You'd need to query this table when the database opens to determine if the user has eleted to not see the form again. In
your code, immediately before you open the dialog form:

If Nz(DLookup("bShow","tShowDialogs","sFormName='" & YourDialogForm & "' AND sUserName='" & CurrentUser & "'"), False) =
True Then
'/open you dialog form
DoCmd.OpenForm "YourDialogForm"
End If

You'll need to change "YourDialogForm" and table/column names to match those in your application.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
You'll have to forgive me, I'm kind of new to this Access stuff. Where
exactly do I need to put that code? Also, do I need to create a new query,
or does that code do that already? If so, what would the SQL statement be
for the query, assuming I made the table using the field names from your
example? Again, I apologize for all the questions. I just figured someone
would have asked about a check-box to disable a pop-up already.
 
Back
Top