I'm creating a tabbed form in Access 2007, and in the first 3 tabs, when I dragged the field controls onto the form, they stretched to the width of the form and all stacked nicely underneath each other.
Now on the next tab they are coming out as much smaller. I don't want to stretch them to fit as I want them a uniform size and I just want to find how to get that setting back! I've been messing with the anchoring buttons to what seems like no avail!
I have a form with one field on it. I want to be able to look up a value on this form and based on whether it is in the table or not give a message box saying yes it is there, or no it is not and then reset the form to look up another value.
I would like to justify everything so it is in the centre of the cell in the datasheet. Can this be done? Also is there any way that you can wrap text in a text box?
I dont have room on my form to read a text box from left to right so can it be rotated? so i read the text from bottom up as you can do in word text boxes or excel cells?
I've got a form which holds data for employees, fname, lname, ..... and an entered date which defaults to now().
On the before update event, i have the following.
Code: If DCount("*", "trainingdata", "[Empid]=" & Me!EmpID & _ " And [subjectid]=" & Me!SubjectID & _ " And [trainingdate]=#" & Me!TrainingDate & "#") > 0 Then MsgBox ("This record already exists") Cancel = True Me.Undo Me.SubjectID.SetFocus End If End Sub
With the above vba code, a msgbox pops up if the record combination already exists. What I would like to do is in the same msgbox have the "entered" date display and make the msgbox say something like.
This record already exists and was entered on 6/18/2015, [entered]...
I have a form (MS Access 2003) that has a button that when pressed, assigns the current time to field [Time1] using
Code: Me.Time1 = Now()
I have another field [Time2] that adds 15 minutes to [Time1] using the following in the Control Source field
Code: =DateAdd("n",15,[Time1])
I was wanting to use these to force a message box when the system time reached Time2 and tried the following code on the Form ON TIMER event (Interval at 1000 ms) but it does not work.
Code:
If Time() > Me.Time2 then MSGBox "Time to show message" End if
I tried putting in a manual time in the VBA such as:
Code:
If Time() > #2:05:00 PM# MSGBox "Time to show message" End if
which worked. So, I am guessing there is something with my orignal code using Me.Time2 that is causing the problem.
I have a series of Unbound control boxes in one row. some text extend to two lines and I want everything to be centered both horizontally and vertically.
Can't figure out how to vertically align the contents of the controlb boxes...
I have created a form and want to turn the text in a header to a vertical read. I have tried all I know even pasting from excel and it just stays horisontal? Any help would be great.
I have a multicolumn listbox on my form. It works, but the second column is an amount, and I would like that column to be right-adjusted. Is there a way to do that?
I have a report that was created on my computer. When this report is opened on other computers (2 that I've tried) the text alignment is way off. Originally I thought it had to do with printer margins dictating something but that is not the case as the margins remain identical on all computers. It's not a font issue because it's Arial which all computers have. The text is written inside a "label".
I have a form with many fields on it. For some reason some of the text in the form fields don't line up vertically with other text even though I have aligned them to the grid and to each other. I have Access 2013.
I created this function to manage a MsgBox containing all required fields with no data:
Code: Function FormValidation(TheForm As Form) As Boolean Dim boolResponse As Boolean Dim strError As Variant Dim ctl As Control boolResponse = True strError = Null
[code]...
Then, I have a Form_BeforeUpdate event, where I wanna place the function, which contains also some VBA code to manage duplicates records:
Code: Private Sub Form_BeforeUpdate(Cancel As Integer) Dim rst As DAO.Recordset, dbs As DAO.Database, strICAO As String Dim ctl As Control, txtMsg As String
[code]....
Now, how to add the function in this event to get these two results:
1. if required fields are blank and I press OK on the MsgBox, the routine must stop; 2. the focus must go in the first required blank control.
I tried some options but I get different kind of malfunctions: no custom message for duplicate records but only the access default one, "go to next record" feature with tab key not working and so on.
Having set a table short text field to 'Indexed (No Duplicates)', I have a form which produces a '2105 runtime error' when the user attempts to submit a duplicate value. I would like to replace this default error message with a more user-friendly MsgBox.
My code for the SaveRecord button is:
Code:
Private Sub SaveRecord_Click() DoCmd.GoToRecord , , acNewRec MsgBox "Record successfully saved", vbOKOnly + vbInformation, "Record Saved" End Sub
My code to capture the 2105 runtime error is:
Code:
Private Sub Form_Error(DataErr As Integer, Response As Integer) If DataErr = 2105 Then MsgBox ("This villa booking has already been logged.") Response = 0 End If End Sub
Unfortunately when the save button is clicked (when attempting to save a duplicate value), the 2105 error still runs. What are I doing wrong?
I have a problem with my database I have a combo box that will search for my record. Actually its working I input the specific number it goes to the specific record. But I want, if there no existing record in my database it will display a Messagebox that "No record Found" I try to put a code in a macro builder in a after update property field but nothing happened.
Expression code that it will display the msgbox if there's no record found.
the given code from macro builder is attached. I try to have an if else statement but I dont know how to not equal that giver conditional expression.
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