Could anyone please tell me what is wrong with this event procedure? I get an compile error always. What I want is, if the condition is not met, the message box would pop up otherwise close the form. Please help.
Private Sub (Field Name)_BeforeUpdate(Cancel As Integer)
If (Me.MyFieldName = condition) Then
MsgBox "My Message"
End If
Else
DoCmd.Close
End Sub
i have an event procedure with a msgbox using vbOKCancel. if the user clicks cancel, basically i want to cancel the event. If the user clicks OK, I want to resume the event and complete the bunch of commands. What statements do I need to do this. I assumed that cancel meant cancel.... but...
I am trying to popup a messge box that has multiple lines.
I have three textboxes on my form
When I click the button I want a messagebox to pop up and say ON FOUR LINES:
"Are you sure you want to update:" Textbox value 1 [The actual value] Textbox value 2 [The actual value] Textbox value 3 [The actual value]
I am starting with this but am a bit confused...Any help woudl be appreciated...
Code:If MsgBox("Are you sure you want to update this?" + "THIS:", vbYesNo + vbQuestion, _ "Save Record") = vbNo Then MsgBox "DOING NOTHING" Else MsgBox "DOING SOMETHING" End If
I've included the following code for when my report has no data.
Private Sub Report_NoData(Cancel As Integer) MsgBox "No data for report" Cancel = True End Sub
but when you click OK on the MsgBox, the code falls over within the form, which originally opened the report on the calling line with an error message "The OpenReport action was cancelled".
This is the line of code in the form.... DoCmd.OpenReport "My report", acViewPreview, acEdit
Hi, I have a formcalled Register and this table contains Name-of-Employee, Username and some other fields. The form searches the Register table when someone wants the register, and if the username is already taken up by another user, it gives a message box saying that the username is already used, and also it will give some suggestions as well. I want the MsgBox to take the first letter of "Name of Employee" and then put it beside the username, and show it as a suggestion. Here is the code I already have: Dim d As Database Set d = CurrentDb Dim r As Recordset Set r = d.OpenRecordset("Staff Login")
Dim h As String h = Me.Username
r.MoveFirst Dim flag As Boolean flag = False Do While Not r.EOF If h = r![Username] Then flag = True End If r.MoveNext Loop
If flag = True Then MsgBox ("This Username already exists" & vbNewLine & vbNewLine & "Here are some suggestions:" & vbNewLine & (Me.Name_of_Employee) & (Me.Username) & vbNewLine & (Me.Username) & (Me.Name_of_Employee)) End If
The code works perfectly up to here, but the thing is that I want it to show the first letter of "Name of Employee" beside the "User Name" and maybe the other way around.
Please help me as soon as possible, I am really in a great hurry
I have a message box that says "Backup complete" but it has an Ok button. Is there a way for the user to see the message and then close without hitting the ok button?
here's my code
MsgBox "Backup was successful and saved", vbInformation, "Backup Completed"
This seems like a dumb question but for the life of me, I cannot figure out how to do it.
I want to display a message box when a form is opened and displayed based on some test done in the Form_Current Event. However all the code in the Form_Current event is fired off before the form is displayed. But I want the form to be displayed first.
The MsgBox is modal so the form isn't displayed until I click the OK Button on the msgbox.
How can I display the form first and then display the MsgBox?
This should be simple but I just can't get it to work.
I have a form which has different account numbers and a percentage is alotted to each account number. Trying to create an unbound calculation that if it exceeds 100% a message comes up. My current code is :
If (Me.PercentTotal > 100) Then MsgBox "The total percentage cannot exceed 100%", vbCritical, "Check You Numbers" End If
I have a form with a sub form. On the sub form I have #Ordered, #Supplied & #Used. These fields calculate to give the user the # in stock. This figure is displayed on the form. On the form I also have the Reorder level which is set by the user.
I would like to be able to make a message alert pop up when the database is opened or when any of these records show the # in stock is lower than the Reorder level, ensuring that we do not run out of stock.
I have a field on my form which I want to display a message box when something is entered.Private Sub BoI_AfterUpdate()Box = Msgbox("Is the booking date at least 7 days before the hiring and no more than 8 weeks in advance? If so, click Yes, otherwise, click No. You can check the calender on the Open Form under the 'Miscellanous' tab to check the date. Thank you.", vbYesNo, "Validation")If Box = vbYes Then Cancel = FalseElseCancel = TrueEnd IfEnd SubThat's my code, but I get an error after I type something in that field (BoI)."Compile error: Else without If" I have tried it with 'ElseIf Box = vbNo Then Cancel = True' but that also gives the same error.What's wrong with it?Thanks in advance. :D
Hi, I'm a little confused here. I'm using the following on one DAP and it works just fine. When I add it to another page, it does not work. Any ideas?
<SCRIPT language=vbscript event=onclick for=Save> MSODSC.CurrentSection.DataPage.Save() msgbox "Record Saved - you may continue to edit or exit your browser.",64,"Saved" </SCRIPT>
is there anyway to create a msgbox without OK button i.e., is there any way to display a window to show "data processing..." and then close it after the processing completes.
I have 3 text boxes on my form, which data is inputed to and then on a click of a button, is transfered back to by table to store this data.
problem is that the user entering the data keep putting in the wrong figures in, by this i mean instead of inputting 12345 they often put in 1234 abd leave the 5 offobviously giving us a duff figure.
i want to have a meassage box to appear to ask the question if the figures are majorly different.
my 3 boxes are called:
[impressions(a)] [StdPack(b)] [Output(c)]
i need help with the following statement please: logic if the stdpack(a) is more than or less than 6000 [impressions(a)] msg to appear "the standard pack is considerably different to the impressions, is this correct" yes/no, if no get focus on [StdPack(b)] logic or if the [Output(c)] is more than or less than 6000 [impressions(a)] or [StdPack(b)] msg to appear "the [Output(c)] is considerably different to the [impressions(a)] or [stdPack(b)], is this correct" yes/no, if no get focus on [StdPack(b)]
if yes to either msg box continue as normal
i need all this to be run on the lost focus of [Output(c)]
I have a form which I use to run an append query. The criteria used to run this query is the SSN field on the form. This field has 13 characters and the following format:
000-00-0000Ab
I need a msgbox to pop up when the SSN field is not of the following format 000-00-0000A meaning that if it contains any letter after the ssn that is not A then the msg box should pop up.
It may seem a rather simple question, though it continues to confound me -and I have searched to no avail :D
How do you trigger an event depending on what button is pressed on a msgbox?
For example, using a vbYesNo msgbox on a form, how can I assign events to either the Yes or the No option? Say, if "Yes" is clicked the focus would be set to a control on the form, and if "No" is clicked access would close down.
Any ideas?
I've currently got on the on click event of a command button (the bit in italics is fine, the bit in bold is not working!):-
Private Sub Command3_Click() On Error GoTo Err_Command3_Click
Dim stDocName As String
MsgBox "Please select where you wish to save the exported file", vbOKOnly, "Save To Location"