GetDotted Domains

Viewing Thread:
"Microsoft Access or Visual Basic HELP!"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Wed 04/12/02 at 17:53
Regular
Posts: 787
I've got a nice little database working, its a booking system and it all works!

The only problem is that once you press the exit database button it closes it straight away!

I want to create a nice little message box to ask whether you are sure you want to quit, I havn't got a clue howto do this and Access help is a pile of crap!

It's got to be an 'OK' or 'Cancel' box which is '1' or vbOKCancel...

Can someone either tell me how to assign a message box like that to a button or just upload a basic form with one button that does what I want so that I can see how it works...

I'm sure I'll find out somehow someday but I know someone here will be able to help me better and prevent me from ~buggering~ up my database... again...

Thanks!
Sat 07/12/02 at 02:47
Regular
"Kill all Hippies"
Posts: 437
ph1ll1p:

try www.programmersheaven.com

The Visual Basic forum is full of experts who are more than willing to help.
Fri 06/12/02 at 16:08
Regular
"Chavez, just hush.."
Posts: 11,080
The cancel button quite the database, the OK button doesn't, nothing hard to change...
Fri 06/12/02 at 09:50
Regular
""
Posts: 303
What??
Obviously the msg box needs close whatever you click. The statement 'end' in the 'if yes' statement will exit the program. Clicking 'no' merely exits the function and returns focus to the trigger (in this case the form).

Im using 'end' as an example. Its not hard to figure. You can replace it with other functionality if you wish (end the application, close db connections, scratch your **** etc etc etc).

MM, you must be using a different version of Access to me here, as i cant read it.
Thu 05/12/02 at 20:50
Regular
"Chavez, just hush.."
Posts: 11,080
Oh sod it...

DW nearly got it!

The code reads:

If he clicks 'Yes' then display 'You clicked yes' and then close the diaogue box!

If he clicks 'No' then display 'you clicked no' and close the program!

I've sorted it out now and nicely edited it so that it all works! And looks good!

It's a pain, I've got to sufficiently edit the coding of the database away from the wizard stuff in access so that I can get more marks otherwise I can only get 50% marks...

I'll show you the code I finally used when I email the database home tomorrow just to show you how I managed to do it!

It's quite easy once you think about it!
Thu 05/12/02 at 19:50
Regular
Posts: 11,597
He made it so that when he clicks Cancel, it still closes?
Thu 05/12/02 at 18:18
Regular
"bing bang bong"
Posts: 3,040
a) Doesn't close the form
b) looks like spaghetti

If you've downloaded the mdb I linked you too, copy the code from that, it's 3 lines :O)
Thu 05/12/02 at 16:13
Regular
"Chavez, just hush.."
Posts: 11,080
I read the code again and noticed how it all worked...

I shoved the code that atg gave me in there and it all worked apart from one rather large problem!

Read the code again!

It all works fine, just he's made a mistake in what it does!
Thu 05/12/02 at 10:08
Regular
"bing bang bong"
Posts: 3,040
ajg wrote:
> just put it in the click event of the button. ie
>
>
> Sub Exit_database_Click()
> clicked = MsgBox("Do you want to quit?", vbYesNo +
> vbExclamation, "Confirm")
>
> If clicked = vbYes Then
> MsgBox ("You clicked yes")
> end
> Else
> MsgBox ("You clicked no")
> End If
> End Sub


*gags*
Thu 05/12/02 at 09:18
Regular
""
Posts: 303
just put it in the click event of the button. ie


Sub Exit_database_Click()
clicked = MsgBox("Do you want to quit?", vbYesNo + vbExclamation, "Confirm")

If clicked = vbYes Then
MsgBox ("You clicked yes")
end
Else
MsgBox ("You clicked no")
End If
End Sub
Thu 05/12/02 at 08:36
Regular
"bing bang bong"
Posts: 3,040
http://homepage.ntlworld.com/mistletoe/phi11ip.mdb = example of what you are trying to do

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Continue this excellent work...
Brilliant! As usual the careful and intuitive production that Freeola puts into everything it sets out to do, I am delighted.
Second to none...
So far the services you provide are second to none. Keep up the good work.
Andy

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.