access forms: forcing UCASE in a textbox - sql

i would like to force the textbox to immediately change the text to UCASE as soon as the user moves away from the field. is this possible?
the important thing is that this text will be used in a SQL query to update a table.

In the after update event of the text box on the form, simply go:
If isnull(me.MyTextBox) = false then
Me.MyTextBox = ucase(Me.MyTextbos)
End if
You can also specify a input mask on the form.
">LLLLLLLLL"
The above ">" will force all chars as you type to upper case. The number of L is a any char mask. (and, you don't need the " around the input mask)

Solution from Albert don't work for me.
I use this method: put form in "design view", select the control, in the property sheet, in the format tab, in the format property insert the value ">" w/o quotes.

Related

Access Macro - Was textbox changed from default value?

I have an Access form with textboxes that contain some default text. The users are required to replace the text with words of their own, so I wrote a macro to confirm that (before proceeding to the next record) the text boxes no longer contain the default text. (It gives user a warning plus some other tasks, which is why I'm not using built-in Validation rules.)
The macro contains this sequence:
SetLocalVar
Name: booDetailDefault
Expression = [Forms]![frmChangeReq]![txtProblem].[Text]=[Forms]![frmChangeReq]![txtProblem].[DefaultValue]
The idea is if ...[Text] is the same as ...[DefaultValue], then booDetailDefault would be TRUE, and if not, FALSE.
However, what I do get is "Type Mismatch". I would think that Text and DefaultValue would be the same type.
Can you tell why I got this error?
Is there any way to display the Text and DefaultValue values so I can see why Access thinks they're different?
Is there a better way to see if the text boxes have been changed?
EDIT: The default text is set in the Property Sheet for the textbox. I've been running it manually, not tying it to an event yet, until I get it working.
I used Text instead of Value because that's what was available in the Macro Builder, but just in case I tried changing it to Value. It works, although I have to tell the expression to expect quotation marks around half of it:
[Forms]![frmChangeReq]![txtProblem].[DefaultValue]="""" & [Forms]![frmChangeReq]![txtProblem].[Value] & """"

Multiply two text box values and show sum in third text box

I need to multiply the values of two text boxes and display the sum in a third text box in Word.
I have tried every variation of code I can think of.
When entering data in the first two text boxes, no error is generated but no answer appears in the third text box.
I am trying to multiply the results entered into Word text boxes (Legacy Forms, Text Form Fields) bookmarked "Text61" and "Amount247", showing the results in the same type of text box, bookmarked "Text71".
Sub MultiplyTotal()
Dim ff As String
ff = ActiveDocument.FormFields("Text61").Result
ff = ActiveDocument.FormFields("Amount247").Result
ff = ActiveDocument.FormFields("Text71").Result = ("Text61") * ("Amount247")
End Sub
The code in the question is on the right track for performing the calculation, it just needs to use the variable(s) for capturing the results and performing the calculation a bit differently.
One variable is required for each item to be included in the calculation.
Since calculations are done with numbers, it's also helpful to force-convert the text (String) to a numerical value (the Val function), although if the user is careful it's not strictly necessary in VBA - but a good habit.
Sub CalculateFF()
Dim ff1 As String, ff2 As String
ff1 = ActiveDocument.FormFields("Text61").Result
ff2 = ActiveDocument.FormFields("Amount247").Result
ActiveDocument.FormFields("Text71").Result = Val(ff1) * Val(ff2)
End Sub
Note that it's not strictly necessary to use code to perform simple calculations in Word documents containing form fields, where forms protection is activated. A calculation type of form field can be used that executes a calculation without the need of code. If that approach is of interest, ask in an end-user venue such as Super User.

SSRS textbox hanging indent

I currently have a text box within a table that displays multiple stores based on user parameter input. The problem that I am experiencing that I would like to have a hanging indent that will force the store name to indent once it wraps to the next line (see screenshot).
Is this possible? I am aware that I could put the "Stores:" in it's own textbox, however this makes it difficult when it comes to lining up report items to prevent hidden/merged cells/columns during export to Excel.
The code that I am currently using in the text box is ="<b>" & Microsoft.VisualBasic.Interaction.iif(Parameters!StoreKey.Count > 1, "Stores: ", "Store: ") & "</b>" & Microsoft.VisualBasic.Strings.Join(Parameters!StoreKey.Label, ", ")
The Textbox property you're looking for is called HangingIndent. Try setting it to -10pt.
You could use a table, in the first column you put "Stores: ", in the second the string value, set the borders to none and finally play a little with the alignment (First column top-right alignment & Second column top-left alignment, its your choice) to make it look as if it was all in a single text box.

Vbscript Inputbox unselect the text

Below code works perfect but the inputbox show’s text as "Wind" with auto selecting in the inputbox.
Is there any option to show without selecting... I mean the cursor should be last character of "Wind"
mycode...
Dim Prefex
Prefex = "Wind"
sNewComputerName = InputBox ("enter data here", "Computer Name", Prefex , 30,30)
If sNewComputerName = "" then
End If
To summarize comments:
InputBox is a very limited function, and doesn't have any possibility regarding the way it is selecting the default value.
so you need to press the right arrow before typing.
No other way around!
if you want nicer things, as #Rubik suggested, you can generate a proper InputBox with another language, you would be able to manage it. But that's a lot of work (rewrite your code!) for a minor disagreement!
What are you trying to do?
A user can take Wind out of the box and it will not be returned. If you want to make sure a user entered text the return value can be tested for "" or Wind.
if you want the " displayed
chr(34) & "Wind" & chr(34)
If you just want to prefix everything with Wind I would do that after the text was retuned

Logic to Correct an Incorrect User Input (VB.Net)

I am looking for logic that converts an incorrect user input to a correct integer input.
For example, a user might mistakenly type in letters within an integer input and the logic changes that input to the correct form(integer).
Any ideas?
If you want only numeric values, you can use a numeric control instead of textbox (NumericUpDown if I remember correctly). Otherwise, you can listen to the OnKeyDown or OnKeyPress event, "see" what's inside the argument (the key typed by the user) and eventually change its input. For instance, I'm in Italy and often users use . or , for decimal separator. So I translate dot to comma while the user types. Also, when a non-number is typed, I set e.Cancel to true so nothing is appended to the text displayed.
For typing errors, a BK tree is often used, in conjunction with Levenshtein Distance. Here is a good explanation on how this is applied.
Why would you correct incorrect input? You would want to prompt the user to re-enter the information correctly and tell them to enter an integer.