Message Box at Startup Help

kentwood

Registered User.
Local time
Today, 13:52
Joined
Aug 18, 2003
Messages
51
Have a database that when opened, has a message box that appears and when this box is closed via a Close button that I have named "OK", the main form opens. I have a Tip table that I type in the message which then appears in the messaage box form. It works perfectly providing I use a Next Message/Previous Message Button to control which of the many numbered messages on my table I wish to use.

What I want is to make sure my users have no control over what message is shown. I would still like to maintain all messages on the table by number and only have the Close (OK) button on the form. While trying to do this with the present code and if I only have 1 message on the table (#1) it will show that message. If I add a 2nd message to the table (#2) without erasing the 1st, it still only shows the first. This way I have a record of everything I have sent messages on. Below is the exisiting code used for my message box with hopes you can tell me what I need to change to make this happen:

Private Sub Form_Load()
On Error GoTo Err_Form_Load

Dim intTip As Integer
Dim intCount As Integer

Randomize
intCount = DCount("*", "tblTip")
intTip = Int(intCount * Rnd)
DoCmd.GoToRecord , , A_GOTO, intTip

Exit_Form_Load:
Exit Sub

Err_Form_Load:
Resume Exit_Form_Load

End Sub
 
Found this here once, credit to the creator.
I think if you remove the buttons, it should do what you want.

Dave
 

Attachments

thanks for the send. Actually, I also found the same database sometime ago and that is the sample I am using. I have removed the buttons but as the code is written, it will only read the first message I put on my table, and none other. I want it to read the Last message on the table, regardless of how many there are there. Is that possible?
 
Easy to alter....

Delete:

' Dim intTip As Integer
' Dim intCount As Integer

Randomize ' Seed random-number generator.
intCount = DCount("*", "tblTip") ' Get record count for tblTip
intTip = Int(intCount * Rnd) ' Generate the starting Tip Value
DoCmd.GoToRecord , , A_GOTO, intTip ' Goto the randomly selected Tip

and simply put:

DoCmd.GoToRecord , , acLast

Dave
 

Users who are viewing this thread

Back
Top Bottom