MS Access VBA Function Result in Form Text Box Control - forms

I've written a custom VBA function and would like the output to print out into a text box. The function is simple but I keep getting #Name in the text box.
What is the proper way to set the Control Source to a custom VBA function in an Access Form Text Box?

This is a vague question ...
Control Source : =MyFunction()
You should, of course, check that the function works. The immediate window is useful for such testing. You can also use an event to get the result and set the value of the textbox.

Related

How to insert form block in developer mode in Squarespace

I'm working on a Squarespace website in developer mode where I can create the website with code.
In the file site.region, I noticed that I can insert a footer block using this code:
<squarespace:block-field id="footerBlocksMiddle" class="Footer-blocks Footer-blocks--middle sqs-alternate-block-style-container" columns="12" label="{localizedStrings.footerMiddleBlocks}" />
However, I haven't been able to figure out how to insert a form block preferably so that I can set it as email storage.
I tried <squarespace:block-form but that does not work.
The error looks like this on the squarespace configuration page:
"Something went wrong."
How do I write out this code?
What's actually going on in the footer code you mentioned, is that a block field is being inserted. Within that block field, you can add whatever blocks in whatever arrangement you like.
So to accomplish your goal, you'll insert a block field and then add only a form block to it. Then, in other places where you want that form block to appear, you add the block field (containing the form block) into the code.
As long as you use the same id, the same block field will be reused, allowing you to edit the form in whatever area you happen to be in, and changes will affect everywhere else the block field was placed.
<squarespace:block-field id="myFormOnlyBlockField" columns="1"/>
Place that where you want the form block to appear. Of course, initially, you have to add the form block to it and configure it. From then on, adding the code above throughout your site template will show the form, and changing any instance of the block will affect all instances.
Note that I've set 'columns' to '1' in the example above, figuring that you're just adding a single block so no need to have more columns. you could set it to something else and it'd work just as well. Also note that the areas where you add the block field might have a bit too much spacing/padding/margin around it, so you may need to CSS to adjust for that.
Alternatively, it is possible to execute JavaScript within a code block to make an AJAX/Fetch request to the page with the form block on it, and have that form block replace the code block within which the JavaScript is executed. Such an approach would work even without developer mode.

vscode extension how to display a form

I wish to create a VSCode extension with an entry form on it - some way of input. So far I have only seen document processing or output for an extension.
How can you display a form of input fields in a vscode extension?
How much data do they need to enter? If it's not much, you should be able to handle it with a series of InputBoxes
From https://code.visualstudio.com/docs/extensionAPI/vscode-api
showInputBox(options?: InputBoxOptions): Thenable<string>
Opens an input box to ask the user for input.
The returned value will be undefined if the input box was canceled (e.g. pressing ESC). Otherwise the returned value will be the string typed by the user or an empty string if the user did not type anything but dismissed the input box with OK.
Parameter Description
options?: InputBoxOptions
Configures the behavior of the input box.
Returns Description
Thenable<string>
A promise that resolves to a string the user provided or to undefined in case of dismissal.
The Visual Studio Code API does not have any native methods to display forms to collect input. You can however, chain together Input Boxes, Quick Picks, etc... You can find all these methods under vscode.window.(...).
If these do not satisfy your needs you can implement a webview which allows you to render integrated HTML in Visual Studio Code and trade messages with the extension.
The most simple aproach would be to simple send all collected data from the form to the extension once you hit the submit button or something similar.
You have a nice little tutorial on how to do that here.
Another approach is to see how far you can go with editing JSON objects in settings.json. I thought I would need a form for 8-10 fields, but it turns out that I can create a settings template that has a series of labels and and entry fields (with type validation).

install4j: Configurable form change visibility from drop-down list

I have a Configurable Form and i want to change the visibility of another field based on the value of a Drop-down list.
For example I have a Drop-Down list with entries A,B and the variable name for it is testDD.
I have a Text field smtpMailServer that I want to display only if testDD's value is A.
I have tried the following approaches in smtpMailServer's visibility without success:
return ((String) context.getVariable("testDD")).equals("A");
return (context.getVariable("testDD")).equals("A");
and I've also tried to add a script to testDD Change Selection Script with The following code
context.setVariable("ThisFormConfiguration", selectedItem);
And use the code above with ThisFormConfiguration instead of testDD. But it's not working.
Could you please help me?
Thanks!
I have tried the following approaches in smtpMailServer's visibility without success
The visibility script of a form component is only evaluated when the form is shown. You should keep it, but it only handles the initial condition.
and I've also tried to add a script to testDD Change Selection Script with
The following code context.setVariable("ThisFormConfiguration", selectedItem); A
Using the "Selection change script" property is the right idea, but your script has no effect. There is no live binding from the variables to the form components, the variable is read when the form is shown and updated when the user clicks "Next".
You have to use the following selection script:
formEnvironment.getFormComponentById("123").setVisible(selectedItem.equals("A"));
where "123" has to be replaced by the ID of the text field.

Alter input of form before it is submitted

I'm creating a multilingual Drupal site and trying to implement a search function, that only displays results in the current language, that the user is viewing the site through.
Using Drupals own searchfunction at /search/node it is possible to select which language to search for through the "Advanced search" options, and it works perfectly. However, I dont want to expose these language selectboxes, I just want it to only search in the current language automatically.
What's the best option to do this?
I have one solution where I create a hook_form_alter function, that sets the #default_value in the language selectboxes to the current language, and then I hide the whole "advanced options" with in css. This doesnt seem very right though.
I think the most clean solution would be to hook into Drupals form-processing process and append ex "language:en" to the input text, but I cannot get this to work.
Does anyone know if it is possible via one of the Drupal form related alter functions, to get a hold of the input text and alter it before drupal does its final processing of it?
To answer your question specifically, while using 'hook_form_alter', you have a referenced variable called '$form_state'. This stores the values in the form, and any change there will be passed further.
Also,
I think setting a default value and hiding the field is a good solution as any, only, if you are hiding it you should do it server side, while altering the form. The same field you are setting the default value to. like this:
$fieldname['#type'] = 'hidden'.

Get form field value via module [VBA]

I have a program built with VBA, in access.
I have a form with the field chDate and I need to get the value of the field in a module file named Global (not class module).
I tried to access it but I think I get empty value, string. not error.
I'm no expert with VBA, its new to me (I have experience with VBS).
Can someone please help me and tell me how can I access the value of a form field via module file?
Thanks!
If you can provide some sample code, it might help us in trying to get you a solution.
Here's what might work:
Dim an object as an instance of your form, and set the instance to a new instance. These two lines will do that (assuming the form is called frmForm)
Dim theForm as frmForm
Set theForm = new frmForm
then Show that Form:
theForm.show
The form will get the focus, so you can populate the fields. At that point, once the form is hidden, your code should be able to pull the field as such:
var1 = theForm.txtFormField.Text
However, if you unload the form in code, all variables directly tied to the form will be lost. In that case, you might want to follow Oneide's example, and set a global variable to the value of the form field. You can do this in one of the form's event handlers.
Let me see if I can recall my Access days. In your global module you should access the form field be prefixing the form name i.e.
var1 = Form1.txtFirmField.Text
As far as I know, you're trying to get the data the wrong way.
Anytime you would try to get your form data, from a standard module, your form probably will already be closed or, if you're not opening it as a restricted window, the value will not be ready yet.
Anyway, if you could get pass through all the difficulties above, you're probably coding in a not standard / right way.
Remember that VBA is an event driven language, and you would be better using it's strenghts rather than fighting against them.
As a final word, if this is just a casual coding, I suggest you using a global variable and make de Code Behind Form have set it up on control's change event.
If you're not sure what I mean, please leave a comment and I'll try to explain it better.
And, if you don't mind, let us know more about your starting code to get better answers.