01-10-10, 12:03 #1Registered User
- Join Date
- Jan 2010
Unanswered: Auto-input/default value on continuous form?
Please see my attachment to get an idea of what I am looking for.
At present, when the user selects a Contractor and StandardType from the first form via the combo box and selected START INPUT button, a new form opens to allow the user to input data based on a query.
The query is an unmatched query between tblStandards and tblStandResults and it uses the criteria from the combo boxes on the first form.
Once the main input form loads, it displays fields from tblStandards which are for information only and fields from tblStandResults to allow the user to input and create a record based on that particular standard.
At the moment, i am using an OnLoad event procedure as follows:
Me.StandardNumber = Me.Controls("tblStandards.StandardNumber")
Me.ContractorNumber = Forms("frmInitialInputContractor").Controls("Contr actor")
You will see on the main input form, the first record on the form, the 2 text boxes on the left hand side will have numbers in them and the rest of the records will not. These numbers come from the OnLoad event procedure, taking the value from the first combobox on the initial input form and the standard number from the text box labeled as Standard Number at the bottom of each record.
What I want to be able to achieve with the form is:
a) Have the StandardNumber and ContractorNumber filled in for all records displayed on the form, not just the first one, using a similar process to the OnLoad event procedure.
b) Not create a record in tblStandResults if only the StandardNumber and ContractorNumber have only been entered (both these fields are required to create a record). I was thinking of an AfterUpdate procedure on an unbound tick box, but I am not sure how to implement this and how to prevent a record being created once those 2 fields have data in them.
Please ignore the top filters and buttons, as they do not work at in this example as I have copied the form from my main database, only the close button works. It is the 2 controls to the left hand side of each record I am trying to populate. The standardgroup, standardtype combo box and StandardNumber text box at the bottom of each record will be hidden in the finished form.
I hope I have explained this good enough for you to understand what I am looking to achieve.
Any help is greatly appreaciated.
01-10-10, 18:42 #2Registered User
- Join Date
- Apr 2006
- Huddersfield, UK
I have built db's with a similar tghign to what you want to achieve, the only way around it i found was to have two tables;
Master table (this would contain the contractor info, date etc that you want)
- Sub table (containing this info that attatches to this as a lookup), with the other information that would be needed to be linked to the contractor info.
When you create your form, you have your master form based on your master table, then a sub form in that with the other in continous form mode and you can add as many records as you like to this and they will be linked to the master field and will automatically have that contractor info in there for you.
hope this helps it is a way around something i guess!! ~ dansometimes simple is best.... and i'm just a simple fellow.
01-10-10, 19:23 #3Registered User
- Join Date
- Jan 2010
Hi, thanks for your reply.
I am not sure if i follow you correctly. Is this not how i have my database currently setup?
Tblcontractors contains all contractor info such as address, contact details etc. with primary key as auto number.
Tblstandards contains all the standards with standard info, primary key as standard number.
Tblstandresults containd contractor number, standard number and other fields to record the results if that contractor has met the standard or not.
Because each contractor has 254 standards they are monitored on, this is the reason i would like the contractor number and relevant standard numbers produced by the query already inputted.