on first startup force user to enter data in certain tables

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

Guest

i have a database and all the forms, but when the user first starts the
database i want them to be sent to 3 forms one after the other (because these
tables will be empty), i have sorta cheated so far and used one of the access
templates which has started to work with the company information form but i
cannot see where it is triggered......... any and all help on this would be
fantastic
 
hi,

the_duracell_rabbitt said:
i have a database and all the forms, but when the user first starts the
database i want them to be sent to 3 forms one after the other (because these
tables will be empty),
You may use the AutoExec macro or set the start form (somewhere called
Start in the menu).


mfG
--> stefan <--
 
i already have the startup form as my splash form, what i wanted was for the
db to check that these 3 tables are empty and if there are for 1 time (or
until the user enters somthing in them) divert from the main swithcboard
(which is the 1st form after the splash screen) to these forms........
 
hi,

the_duracell_rabbitt said:
i already have the startup form as my splash form, what i wanted was for the
db to check that these 3 tables are empty and if there are for 1 time (or
until the user enters somthing in them) divert from the main swithcboard
(which is the 1st form after the splash screen) to these forms........
Aha, use the Form_Open event of your splash screen to determine whether
your tables are filled or not (DLookup()). If the need to be filled,
open the corresponding forms with DoCmd.OpenForm "form", WindowMode :=
acDialog. Set the Modal property of these forms to True.


mfG
--> stefan <--
 
stefan

thank you very much, i had been staring at this for a whole day and could
not see what was staring me in the face, but i have never used "dlookup"
before, any help on the code for this and i would be gratefull, and also any
explanaiotn or url's that explain what it does (however short) thanking you
for your invaluable help allready...
 
hi,

the_duracell_rabbitt said:
thank you very much, i had been staring at this for a whole day and could
not see what was staring me in the face, but i have never used "dlookup"
before, any help on the code for this and i would be gratefull, and also any
explanaiotn or url's that explain what it does (however short) thanking you
for your invaluable help allready...
You may use the D-functions for a simple test:

If IsNull(DLookup("field", "table")) Then
MsgBox "No data found."
End If


mfG
--> stefan <--
 
I am trying to do something similar. I have a spalsh screen, but instead it
has a check box linked to a table so that the user can specifiy whether or
not to show the splash screen every time the database opens. However, the
box doesn't work. The screen does open everytime regardless of the setting
of the checkbox. Here is the code that I am using:

Private Sub Form_Open(Cancel As Integer)

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

End Sub

The splash screen is named "Startup" and it is set to be the form that opens
on startup of the database. The checkbox controls a field in a table that
has three fields: sFormName, sUserName, Show(the checkbox bound to this
field). Can you tell me what I am doing wrong?
 
hi,
The splash screen is named "Startup" and it is set to be the form that opens
on startup of the database. The checkbox controls a field in a table that
has three fields: sFormName, sUserName, Show(the checkbox bound to this
field). Can you tell me what I am doing wrong?
First of all, check manually whether you have saved the flag for your
test user. Does an appropriate record exist?

After

DoCmd.OpenForm "Startup"

the code execution will continue. Try using

DoCmd.OpenForm FormName := "Startup", WindowMode := acDialog

Also check if you have set the PopUp property of your startup form to True.



mfG
--> stefan <--
 
The table is updating with the checkbox, if that is what you mean by the
"flag". Here is the whole code for the form so that you can see the Open
event and Unload event as well:

Option Compare Database
Private Sub btnClose_Click()

If Me.Dirty Then
Me.Dirty = False
End If
DoCmd.OpenForm "Switchboard"
DoCmd.Close acForm, Me.name

End Sub

Private Sub Form_Open(Cancel As Integer)

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

End Sub

Private Sub Form_Unload(Cancel As Integer)

If Me.chkDontShow.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.chkDontShow.Value & ")"
End If

End Sub
 
hi,
The table is updating with the checkbox, if that is what you mean by the
"flag". Here is the whole code for the form so that you can see the Open
event and Unload event as well:
Private Sub Form_Open(Cancel As Integer)

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

End Sub
Looks good. Check the properties of the startup form. Set Modal and
PopUp to True.


mfG
--> stefan <--
 
I found the problem. The problem is that since I have the form set up as the
startup form of the database, access opens it irregarless of the setting of
the checkbox. I tried with the database you had to set the form
showFormModal as the startup form and irregardless of the checkbox on
showForm, it always opened when I started the database. So, how do I set up
my database with a spash screen that loads when the database is opened, and
if you check the box, it won't show up after that? Obviously, I can't use
the startup feature of access. Is there a way to use an autoexec macro to
run a query maybe ?
 
hi,
Is there a way to use an autoexec macro to run a query maybe ?
Use a global public function to call in the Autoexec macro, e.g.

Public Function Startup() As Boolean

If <showForm> Then
<show>
Else
<show other form>
End If

End Function


in a standard module.

mfG
--> stefan <--
 
Here's what I have, but it won't open the form regardless of the check box:

Public Function modStartup() As Boolean

If Nz(DLookup("bShow", "tShowDialogs", "sFormName='" & Startup & "' AND
sUserName='" & CurrentUser & "'"), False) = True Then
'/open you dialog form
DoCmd.OpenForm FormName:="Startup", WindowMode:=acDialog

End If

End Function
My startup form is the switchboard which should load behind the spalsh
screen if it would come up.
 
This may all be stemming from the table that records the values of the check
box. After I put a check in the box, there are *two* records, one blank
except for the checkbox, and the other with Startup in the sFormName field
and Admin in the sUserName field. Then if I uncheck the box, the record with
the blank record gets unchecked. Where is this blank record coming from?
Here is the unload event again for the Startup form:

Private Sub Form_Unload(Cancel As Integer)

If Me.chkDontShow.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.chkDontShow.Value & ")"
End If

End Sub
 
Back
Top