Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UPDATING DATA FROM A FORM

Status
Not open for further replies.

Janatwork

Programmer
Dec 16, 2003
22
GB
Hi,
Can anyone help please.
This maybe a daft question, but I'm struggling to get an answer.

I have a form which contains a sub form.
On the sub form, I would like to add a record to a table without the user having to actually enter data.

So ideally if the values in the two fields remain unaltered, I want the user to be able to either enter or tab the fields and then the record be added to the table.
Is it possible to do???
I'm not hot on VB!!!!!!!!, so if it can be done through field properties that would help

Thanks [ponytails]

 
'if the values in the two fields remain unaltered'

Unaltered from what?

 
Hi

This can be done with no code at all

A) in the table set the default values of teh columns to the appropriate value(s)

B) ensure the sub from id bound to the table containing the above columns (or a query based on that table), ensure teh allow Additions property of the subform form is set to true

Now if you move to the lat line (ie new recordline) of the sub form, you need only tab through the fields and a new record will be created, with the two columns containing the defalut values specified

But is this actaully what you want to do?

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi Everyone,

Sorry bit vague there on my help cry!

I have a subform which contains two fields Qty and Label.
The Qty field has a 'default' value which is pulled through from the main form and the Label field has a default value of 1. The user can either leave the fields unchanged or amend one or both of them. If one or both fields are amended then I have no problem, the record is added to the sub form table, however, if the user choses to accept the values already in the fields, I would like them to be able to press enter or tab to accept them and to add the record to the table. ( I am using TABLE A for the main form, which I can't change and TABLE B for the sub form, which is the one I need to write to)


Thanks again [ponytails]
 
Hi

Ok, my comments in earlier post still hold true, except if the default value of the control "Label" is dependand on a value on the main form, I think I would be inclined to handle this by putting a line of VBA in the before insert event of the sub form so

Me!Label = Parent!Label

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top