Google App Maker - autofill textbox depending on dropdown selected option from an external database - mysql

What I'm currently doing is that on the Property Editor of my dropdown widget, on the Event Section using the onValueEdit function, I'm trying to create a custom action script which will give a value to my textbox (using widget.root.descendants.NameOfMyTextbox.value) depending on the selected value of my dropdown.
The values of my dropdown are the IDs stored in my MySql database table Process, for example: ID = 1, name = Assembly, manager = George. For the textbox, I would like to get another table field value depending on the selected value of my dropdown through a select statement (like getting the manager value). What kind of app maker queries or functions should be useful in this case?

If your dropdown option binding is #datasources.Process.items then your onValueEdit event simply needs to be:
widget.root.descendants.NameOfMyTextbox.value = newValue.manager;
This would be the only way to set this up however, because this way the options are pointing to your entire record in the Process table and upon selection you can get any other field from that record using newValue.YourField.

Related

Labview - How to select data from MS access table as input array?

I'm trying to make an array from a set of selectable cells in MS access.
Here's a section of my access DB:
I want the user to be able to select the cells with these numbers, dynamically (while code is running) and an array is created by selecting different cells. How can this be done in labview?
Thanks,
Use the correct code to work with the database (NI's DB toolkit, LabSQL, call the ADO.NET code directly, etc.) and get the data you want from the DB.
Place a listbox or multicolumn listbox on the front panel, change its selection mode to have 0 or more elements, so its data type becomes an array.
Use the Item Names property for the listbox to feed the data from the DB into the listbox.
The user will now need to select multiple items. This can be done by holding Ctrl, or you can call a Windows API function to press and release Ctrl on mouse enter/leave events, or you can use the Mouse Down event to figure out which row the user clicked on and use that to modify the value of the listbox (which is an array of the indices of the selected rows).
Once the user is done, you can read the value of the listbox (from its terminal) to get the indices, and use that to index the data from the Item Names property or from the original data you got from the DB.

saving temporary form on MS Access

I am currently working on a database project using MS Access that allows user to submit their applications via forms and these applications get saved on a masterlist table. I am wondering if MS Access has the ability to support features which allows a user to save a form which they have filled, but not officially submitting it yet, and afterwards at their own discretion they can re-enter to submit their forms, which then only gets captured in the masterlist table. Any suggestions to architect this feature are welcome, or any limitations in doing so
Second suggestion Calls for a few preparations, but makes submitting a very simple task:
Assuming table name is masterlist, add to the table a field
Submitted, Boolean value (Yes/No Value), Default Value = False.
Submitting an application will be done by setting this Field to True.
Change masterlist table name to tbl_masterlist, and create a query:
SELECT * FROM tbl_masterlist Submitted = TRUE. Name this query masterlist.
Now masterlist has only submitted applications.
In design view, Change the Form's RecordSource Property to tbl_masterlist. You can filter out undesired applications from the Form, if you wish, using the From's Filter and FilterOn property
add a checkBox field to applications Form, and in the properties window s set it's Name and ControlSource Properties to Submited, and it's Visible property to False.
Finally, add to applications Form a Submit Button, and in it's OnClick event sub add this code: Me.Submited = True.

Cannot find the referenced form

When I click on the Create New Form button below, I get the following runtime error 2450 dialog box:
When I click on the debug button, it gives me the following:
The main form is called FindClientsNavigation. The "Create New Form" button in the ListOfForms subform is supposed to cause the NavigationSubForm to replace the ListOfForms form with a new CommunicationForm so that the user can enter information from a new form for the Client with the specific Client ID that is available in the txtClientID textbox, which you can see in the top of the FindClientsNavigation form in my first image above.
How do I alter the code above so that it loads a new CommunicationForm in the NavigationSubForm? And how do I get that new CommunicationForm to have the ClientID stored in it, so that submitting the form will allow the form to be saved with reference to the specific ClientID?
The SourceObject needs to be set to a string, which is the name of the form to use:
.SourceObject = "CommunicationForm"
[Note that Forms is the collection of open forms so you cannot use this to refer to a form in the Navigation Pane - unless you know that this form is open.]
You can use the Client ID (on the main form) for this subform, but there are a number of ways to do this and it depends on your specific requirement:
The subform could be based on a query that refers to the textbox (perhaps txtClientID) on the main form. This is one of the simpler approaches.
You could dynamically set the RecordSource for the subform, using a WHERE clause that refers to the Client ID (similar to the above approach).
You could apply a Filter to the subform, so that it only displays the single record for the Client ID.

How to reference a chart object on an MS Access subform?

I have created a dozen different charts using the chart form wizard in Access (so each chart is really a separate form). I have also set up a GUI that has the following nested form structure:
frmMain -> frmSubMain -> Child0 (a subform of frmSubMain)
I have a list box on frmSubMain that lists all the charts, and when a user selects one, I use VBA to change the Source Object of Child0 to the appropriate form for the selected chart. (So in essence, a user can select the desired chart and it is presented.)
I am now trying to add a button to frmSubMain that will copy the currently selected chart to PowerPoint, but I am having trouble with the copy command and referencing the chart object. The chart object on each of the forms is called OLEUnbound0, and here is what I've tried (I have the form name for the chart as a variable 'my_form'):
Forms(my_form).OLEUnbound0.acOLECopy
Me.Child0.OLEUnbound0.acOLECopy
Me.Controls(my_form).OLEUnbound0.acOLECopy
Each gives a different error (for example, the second one gives the error "Method or data member not found"). Part of my confusion is that I have the form name but as a variable, and I'm not sure how to use that variable (since I can't use the standard Forms![frmMain]![frmSubMain]! etc.). What is the syntax for using a variable to reference a subform?
Try:
Me.Child0.Form.OLEUnbound0.Action = acOLECopy

Change the query being referenced by a function, depending on context

I have a custom function in Access 2007 that hinges on grabbing data out of a specific query. It opens Outlook, creates a new email and populates the fields with specific addresses and data taken from the query ("DecisionEmail").
Now I want to make a different query ("RequestEmail") to populate the email with that data. So all I have to do is change this line:
Set MailList = db.OpenRecordset("DecisionEmail")
This is my desired result: If the user is on Form_Decision and clicks the button "Send email", "DecisionEmail" will get plugged into the function and that data will appear in the email. If the user on Form_SendRequest and clicks the button "Send email", "RequestEmail" will get plugged in instead.
My last resort would be to make a new function and use the Conditions field in the Macro interface to choose between them.
I have a vague notion of setting the query names as variables and using an If statement.
Why not save the macro as code, then you can edit away to achieve say:
Function CustomEmail(NameOfQuery As String)
CurrentDB.Openrecordset(NameOfQuery)
End Function
Then, on each form in the desired event:
CustomEmail "DecisionEmail"