Close Button With Warning Message

Aug 1, 2006

I use a close button to close a form. There is list box in this Form. If the list box is empty, then simly close the form. However, if there are projects in the list box, I want to give a warning. If the user say YES, then everything in the listbox will be deleted and the form will be closed. If user say NO, tehn the form will not be closed. They then can use anotehr button to save teh projects.

I wrote the follwing code. The delete portion itself works. But it seesm comfused with msgbox. Could you pelase help me correct this code? Thank you very much for your help.

lbDestination -- list box name



Private Sub Close_Click()
On Error GoTo Err_Close_Click

If IsNull(Me.lbDestination) Then
DoCmd.Close
Exit Sub
End If

If MsgBox("You have unsaved initiatives. Are you sure you want to close?", vbQuestion + vbYesNo + vbDefaultButton2, _
"Delete?") = vbYes Then

Dim rsDestination As DAO.Recordset
Set rsDestination = CurrentDb.OpenRecordset("tbInit", dbOpenDynaset)

rsDestination.MoveFirst
Do While Not rsDestination.EOF

rsDestination.Edit
rsDestination.Delete
rsDestination.MoveNext
Loop

Me.lbDestination.Requery

End If


Exit_Close_Click:
Exit Sub

Err_Close_Click:
Resume Exit_Close_Click



End Sub

View Replies


ADVERTISEMENT

Warning Message...

Sep 14, 2005

Anyone know how to suppress the folowing warning:

(I don't have admin rights so my solution will have to be done within Access :rolleyes: )

View 3 Replies View Related

Warning Message

Sep 9, 2006

ok, i'm probably gonna confuse a few ppl here, lol :rolleyes:

i keep getting a warning message when i try to open winamp from within access, is there any way i can stop this warning message from appearing?

any help would be most appreciated

View 5 Replies View Related

Warning Message

Dec 11, 2006

can someone please modify the following code to add a warning message to an add button.................this add button allows to add details filled in a form...


Private Sub addrec_Click()
Dim strSQL As String
DoCmd.SetWarnings False

strSQL = "INSERT INTO tab_main ([username], [cost_centre], [number], [phone_model], [imei], [puk_code], [sim_no], [date_issued], [notes], [tariff], [call_int], [roam]) VALUES ('" & Me.username & "','" & Me.cost_centre & "','" & Me.number & "','" & Me.phone_model & "','" & Me.imei & "','" & Me.puk_code & "','" & Me.sim_no & "',#" & Me.date_issued & "#,'" & Me.notes & "','" & Me.tariff & "'," & Me.call_int & "," & Me.roam & ")"

DoCmd.RunSQL strSQL
DoCmd.SetWarnings True
End Sub



warning message such as Are you sure you would like to add USERNAME(whateva is inserted in the USERNAME FIELD)


thanks

View 3 Replies View Related

Warning Message For Duplicate Entry

Nov 27, 2006

I have struggled with this for so long now I hope someone can help.
I have a form called frm_Collections which is run from the query (qry_Collections). When I type into the Reg field in the Form I would
like the user to know if the Reg details have already been used in a
previous record. The database can have duplicates in this field, however a
"Warning Message" would promt some investigation.
I have tried loads of DLookup on Before Update, but really need setting of
in the right direction.
Thanks

View 3 Replies View Related

Data Access Page - Message Warning

Feb 7, 2006

Hi there,

I apologise if this has been answered, I couldn't find anywhere else on the forum.

On the data access page it gives an annoying warning that says 'This website is using your identity to access a data source. If you trust this website, click OK to continue, otherwise click cancel'.

Is there a way I can suppress this message? It looked cool at the start, but now it's just annoying....

Thanks!

View 1 Replies View Related

A Warning/confirmation Message For User Before Printing??

Mar 12, 2006

Hi all,

I am building a simple db from scratch using the limited knowledge i have, and a lot of the information gained from searching these forums as a guest. I've now reached a point where I can't seem to find what I'm looking for, so any help would be gratefully received!!

I have a single table, single form and single report (told you it was simple;)). The table has nearly 2000 records and 2000 pictures (linked). On the form I can print every record with a single click of a command button. This is great, but I would like a message box to popup and confirm the print action, as this is gonna be expensive if its clicked on every record!!

If anybody can help, I would be chuffed!! I searched the forums and can't seem to find anything on this!!

j

View 2 Replies View Related

General :: Stop Access Warning Message

Feb 14, 2013

I have an Access 2010 db on a shared network drive. All users accessing the db are running Windows 7 OS and have a licensed corporate version of Access 2010. The advanced options "Shared", "Edited record" and "Open dabases by using record-level locking" are turned on. Additionally, the locking time limits are set to their default levels. If a user selects the save icon after making additions or updates, the following waring message appears:

Costar Job Database can't save design changes or save to a new database object because another user has the file open. To save you design changes or to save to a new object, you must have exclusive access to the file.Since I developed the db, I am the only one that makes design or object changes. I know that users don't need to select the save icon to update the db, but I don't want them to "freak out" if they select save and see the message.
Is there any way to prevent the message from being displayed?

View 6 Replies View Related

General :: Warning Message When Deleting A Table

Feb 16, 2015

I have a temporary table within my access database. I have a macro button that makes the table (thus deleting the old one in the process) and then appends information from three other queries to it.I want to stop the standard warning message from coming up. The message I get is below. I have already cleared the action queries check box so the warnings for the making table (if no previous table exists) query and appending data query have disappeared. However the below message still pops up when the make table query begins to try and delete the old table. How I can make it go away?

"The query you are about to run is a make-table query. Unlike most queries that displays data in Datasheet view, a make-table query creates a table and copies specific records from one or more tables and queries. If the table already exists, the query will replace the structure and contents of the table.If your intention is to create or replace a table, click Yes. To avoid being prompted when you run such queries, click the File tab, then click Options. In the Access Options dialog box, click Client Settings. Under Editing, clear the Action queries check box.

View 2 Replies View Related

Subform Record Count Warning Message

Jan 29, 2013

I would like to show a Message box to an operator when a certain number of records have been reached in a subform e.g when 36 records have been entered I want a message to appear telling the operator that a certain report can then be raised. Whether this is possible

View 5 Replies View Related

Warning Message If Field Is Left Blank?

Apr 10, 2014

I have a questions database. When user is filling out the form, the following fields are required: Questions, Author, Type of Question and Answer selected. Answer is selected by clicking on the button next to the Answers. If these fields are not filled out, a user gets a prompt saying that so and so field is blank. If have a problem, it works for all required fields except for Answer. Below is my code. I have attached a screenshot with Author and Answers blank. I only get a warning about the Author and not the Answers.

Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
nullerr = 0
strnull = ""
If IsNull(Me.txtQuestion) Then
nullerr = 1

[code]..

View 3 Replies View Related

Warning Message On Form While Data Is Being Processed

Jul 11, 2013

I do have a DB that takes some data from Stripes and imports them into access. Since this will be a multi user DB I want to make a warning form.

Basically a user will do the download, I want a form or a pop up message that will show to the next user that will open the DB while the download process is ongoing, to see that the download data process is still ongoing, That he needs to wait until the data download has finished.

View 7 Replies View Related

Modules & VBA :: Device Table - Warning Message Based On Combobox Selection

Jul 26, 2013

I have a combobox with several options for a device's parts. When one part is selected, it gets added to a device table.

ComponentCmb
Generator A
Generator B
Gearbox A
Gearbox B
Blades A
Blades B
Blades C
Tower A
Tower B

I want to display an error message if an option is being selected more than once.

For example, if a gearbox has been chosen, then another gearbox cant be chosen too.

How do i display this warning message.

View 3 Replies View Related

Modules & VBA :: Table With 3 Fields - Warning Message Based On Combobox Selection

Jul 29, 2013

I have a table (ComponentT) of different device components a user can select from ( generators, gearboxes, etc.)

The table has 3 fields - ComponentName, ComponentType, ComponenentDetails

I have a query returning all the ComponentDetails values.

I then have a combobox that uses this query as a row source.

The user can select different components they want from the combobox. Once something is selected, it is added to a new table - UserSelectedComponentsT

As a device can have only one gearbox or one generator etc. I want a warning messagebox to be displayed if the user tries to select a generator from the combobox when one has been previously selected.

View 1 Replies View Related

Pop Up Message On Close Of DB

May 9, 2006

How can i setup a popup message when the user closes the DB.

I need to have an reminder to the user every time they shut the program down!

View 4 Replies View Related

Forms :: Delete Button Warning?

May 8, 2013

Windows Vista
Access 2007

I have added a button to a form that would delete a record. This works just fine.

I would like to add a confirmation that this is something that i'd like to do.

View 2 Replies View Related

Modules & VBA :: Close A Form From A Message Box

Apr 11, 2014

All i want to do is after executing the following code, close the form " EmployeeFind" on completion?

Private Sub Form_DblClick(Cancel As Integer)
On Error GoTo Err_Form_DblClick
Dim stDocName As String
Dim Msg, Style, Title, Response
Msg = "Employee allocated to Job"
Style = vbOKCancel + vbInformation
Title = "Employee moved" ' Define title.
Response = MsgBox(Msg, Style, Title)
If Response = vbOK Then

[code]...

View 5 Replies View Related

Forms :: Stop Generating Message Boxes On Form Close?

Mar 6, 2013

I have some code (see below) that checks if the start date text box is blank or greater than the end date, and if so, generates a message box and sets the focus back to the start date textbox. There are command buttons on the form that open queries based on the date fields. This all works fine.

However, if the user changes his mind and closes the form without filling in the date field, the message box "Please enter a start date" pops up repeatedly. How do I specify that a text box is required UNLESS the user is closing the form?

Code:
Private Sub txt_startdate_LostFocus()
If ((IsNull(txt_startdate) Or (txt_startdate) = " ")) Then
MsgBox "Please enter a start date.", vbOKOnly

[Code].....

View 3 Replies View Related

Error Message Displays When Trying To Close The Form/switch To Design View

May 4, 2006

I have a form with a subform in it. On the main form, I have a combo box with a list of program numbers to choose from. Once one is selected, the subform displays all the unpaid invoices under that program number. This part works fine. The problem occurs when I try to close the form, switch to design view, or scroll the subform to the right. Basically, the error message says that the record can't be saved because it would create a duplicate value in the index/primary key. However, this form is used to display information only. I have disabled the edit, delete and addition abilities, so I can't figure out why it thinks I am trying to change or add a new record. Any help would be appreciated.

I figured it might make things easier if I included a copy of the database, so here it is.

The form is called SETR, and the subform is AllInfo subform.

View 1 Replies View Related

Close Button

May 8, 2006

i have close button on my form made thru the command button. But it does not show an error message when the form closes if information has not been entered in the reqired fields. it does not save the field though. how can i get the error messages to be shown before the form closes asking the suer to enter the missing data. thanks

View 2 Replies View Related

Close Button Without Compacting

Nov 10, 2006

The database that I currently work with has the option chosen to compact and repair on close so that if I am not present when there is trouble the users can close the db and the problem is usually corrected. I currently have a close button on the Main switchboard that closes the db. Is there a way to make a button or another way that will close the db that will by pass the compact and repair choice? I know that I can use task manager, but that usually creates db1, db2 and so on.
Thanks,

View 3 Replies View Related

Close Form Button

Jul 27, 2005

I have a form that is loaded through a hyperlink from another form. On this form I have placed a command button which closes the form (DoCmd.Close) I have also used the full syntax including form name and no save prompt. When i close this form using the command button I get a request for two paramter values that are used in queries in this form (I don't want this to happen) when I click the close button on the control box "X" this doesn't happen also it doesn't happen if I use file close. This problem only occurs on some of the slower machines in my workplace, any suggestions would be greatly appreciated. The is one combo box on the form in question which is set to run a macro after update, this macro requeries the 52 list boxes on the form.

View 4 Replies View Related

Close A Form W/ Cmd Button

Dec 14, 2005

I am building a database to track employees. I have a form to input the personal information and want to close this form and open a new form to input the employee's training information. I have a cmd button to open the Training form for the individual, however I can not make it close the employee input form.

Can someone help with this?

View 6 Replies View Related

Form Close ('X') Button

Dec 26, 2004

i am abit confused.. i have a save button on my form.. this is where field validation occurs and where the closeForm statement is (at the end). I need to keep the form's "X" button enabled.. how would i go about doing this exactly.. can i keep what i currently have (in the cmdSave_click event) and in the form_close event i can maybe have if me.dirty then... call my cmdSave_click event?.. Else.. closeform. Is this the right way to go about it??.. if so.. will my formClose statement (in my cmdSave_click event) be alright?

Thanks in advance!

View 1 Replies View Related

Disable Close Button

Jan 19, 2007

Hello,

Is there a way I can disable the access close button, located at the top right of the screen?

Thanks.

View 6 Replies View Related

Disabling The Close Button On A Form

Dec 21, 2006

I have a form which I want to disable the close button. On the properties of the form I set Close Button option to 'NO'. When I open the form the form close button is disable, but as soon as I maximse this screen, the close button becomes enabled again. Any Ideas as to why this is happening and how I can disable this button comlpetely on this form?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved