I have an MS access project with four forms one main form (BS&W Data) and three subsequent forms (WellTest form, LoopSamplers Form and WellheadSamples form). The subsequent form will be opened by a command button on the main form based on the value of a specific field (Follow-up Method).
I need to link three fields common between the main form (BS&W Data) and other forms, so by data input in these fields in the main form and then opening the subsequent form finding the same fields populated without re-input.
The three field are (Date, Well Name and Follow-up Method)
Thanks
If you open your form with modal property, you will need to pass parameters as arguments to the form using DoCmd.OpenForm
http://msdn.microsoft.com/en-us/library/office/ff820845.aspx
Otherwise, you can use the following syntax to access directly the control's value and modify it. Of course, it has to be open first to make it work.
Forms("subform_name")("control_name").value = ...
Related
i made multiple steps form that the user needs to fill all of them
1st Form (personal details)
2nd Form (education details)
and both action pointed to one servlet which is SaveServlet
can any one of you help me on how to make the second servlet saved in the database? so far i tried only the first form managed to be saved in the database..
i also tried using one servlet for one form and both form were saved into the database but i dont know how to pass the id from the first form into the second form hence im trying to do multiple form in one servlet so that the id would be the same
At the time of 1st Form submitted, do 3 things,
1) Persist data in DB.
2) Set attributes in session and redirect to same JSP.
3) Make a hidden input parameter in 2nd form with the value of ID from 1st form. data-attributes can also be used in this case.
Now you have ID from 1st form to be used when 2nd form is submitted.
I guess you can use ajax for handling multiple forms.
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.
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.
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
So how can I pass a value from one form to another? For example: The user select's an organization from a list and this opens up a trip form that allows a user to enter various information regarding the trip. At one place I would like to add another little pop up form where they can enter contact information (just a name and phone for POC) of the organization they are visiting.
So when that initial form opened from the selection screen it has two IDs that are simply hidden in text boxes (one being the tripID, and the other being the OrgID), so how do I pass these to the second little pop up form so that the contact information has the relative IDs with it.
Thanks.
The best approach in these cases is not to attempted to pass a bunch of variables. It is too much code, and is inflexible. For example, if you need to pass two values, what happens over the years when that requirement grows to 5 values? Trying to maintain and pass a whole whack of values is too much coding work.
Keep in mind that each form in ms-access is really a class object that you can manipulate in code. So, use a object approach here and you find you not only write less code, but your code will be more clean, more modular, no need for global vars, and code you write can often be re-used between different forms.
Here is how:
In general when one form launches another form in the 2nd form in the forms on-open event (in fact, you can even use as late as the on-load event) you can pick up a reference to the PREVIOUS form object. In other words, you can use a object approach here.
At the forms module level, for form I declare a form object as:
Option Compare Database
Option Explicit
dim frmPrevious as form
Then, in the forms on-load event, we go:
Set frmPrevious = Screen.ActiveForm
Now, any code in our form can FREELY use code, events, even varibles declared as public from that previous form in code.
So, if you want to force a disk write of the previous form, and re-load of data.
frmPrevious.Refresh
If you want to set the ID value, then go:
frmPrevious!ID = some value
And, note that you can even declare form previous as a PUBLIC variable for that form, and thus if you two forms deep, you could go:
frmPrevious.frmPrevious!ID = some value
So, simply declare a forms object in EACH forms code module (or at lest the ones where you need to use values in code). The above means any code has a ready made reference to the previous form object. Functions declared as public in a form will become a METHOD of the form, and can be run like:
frmPrevious.MyCustomRefresh
or even things like some option to force the previous form to generate and setup a invoice number:
frmPrevous.SetInvoice
or
frmPrevious.SetProjectStatusOn
So not only can you shuffle values and data back and forth, but you can easily execute features and functions that you build in code for the prevous form.
In fact as a coding standard, MOST of my forms have a public function called MyRefresh.
Note that the beauty of this approach is that you can thus read + use + set values from that previous form. This allows your code to not only receive values, but also set values in that previous form. So this approach is bi-directional. You can shuffle data and values back and forth between the forms. The other advantage here is you NOT restricted to just variables, but can use fields, control values (events, properties) etc.
This approach means that much of the previous form is now at your fingertips.
So don’t try to pass a whole whack of variables. Pass a reference to the form and you have a nice ready made object at your fingertips and it makes this type of coding problem a breeze.
The usual way would be to reference the textboxes in the initial form from the popup form, like this:
Forms!frmInitialForm!tripID
Forms!frmInitialForm!OrgID
However, this tightly binds the popup form to the initial form, so that it cannot be used anywhere else in the application.
A better approach is to use OpenArgs:
DoCmd.OpenForm "frmPopup", OpenArgs:=Me.tripID & ", " & me.OrgID
This places your two values into a string, which is passed to the popup form. You can then parse the two values out of the OpenArgs using the Split function.
For more info about passing parameters using OpenArgs, see:
http://www.fmsinc.com/free/NewTips/Access/accesstip13.asp
This one could help
MS Access: passing parameters from one access form to another