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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to coding

Status
Not open for further replies.

soma1958

Programmer
Oct 10, 2002
32
0
0
AE
I have 2 unbound forms header + subform of 5 fields on the header and three fields on subform and I want to use codes for inserting/updating/deleting records on both forms.And I will use buttons for each action.

Can any one help and show me how to write such code.?

Thanks
 
you can start by browsing the Access VBA forum705. You'll be able to find many examples of what you are trying to do!

HTH

Leslie
 
Or you could use the Form/Sub Form Wizard which will do it all for you.

Then you can go down the pub.

 
Soma

Unless you have some very specific reason (other than whimsy) for using unbound forms that can't be addressed in another manner, I suggest you use bound forms and save considerable time and trouble.

What version of Access and VBA you are using will determine the exact code.

Also whether you are providing your own primary keys or leaving it to the table's autonumber field will impact the code?

You will need to append (see append queries) the record in the main form to the appropriate table, then retrieve or assign the primary key of the appended record. With the PK in hand, you can then loop through records in the subforms and append them. The crux will be to make sure your records stay related.

Cheers,
Bill

 
Hi all
I know perfectly how to use the bound forms but this is a special request.

Please let me know...
 
Did you search Forum705 at all? I typed in 'Unbound Forms Update' and there are 20 hits!

You couldn't find anything there yourself?

Good luck.


Leslie
 
Hi leslie

I couldnt find anything there which meets my need?
Thanks for your help...
 
Hi bill

I am using access 2000 and would like to provide the auto primary keys.

By the way what would the code in the sub form will be when searching a record by record number?

Thanks bill in advance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top