Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 18th, 2007, 08:04 AM
Authorized User
 
Join Date: Dec 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default last or curremt record append queries

I create a form with my table now I want append last or current record should be append to another table how should write the queries or click event code for command button

Mohamed Mohiddin
Officer
__________________
Mohamed Mohiddin
Officer
 
Old January 18th, 2007, 08:45 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Can you clarify? It sounds like when a record is added or changed in one bound form, you want to append that new or changed information to another unbound table. Is that correct?


mmcdonal
 
Old January 18th, 2007, 11:50 AM
Authorized User
 
Join Date: Dec 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi mmcdonal
Thanks for response actual In my form there are four bound field like txtstno, txtname, txtpay, txtloan is there in my form when I add new records I want to add another table like tblLoan Now I want when I click the command button I want add all filed above to be added in tblloan



Mohamed Mohiddin
Officer
 
Old January 18th, 2007, 12:31 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Why do you need to duplicate this data in a second table? Perhaps a query would work instead.

Please let me know how you would like to proceed.


mmcdonal
 
Old January 18th, 2007, 01:24 PM
Authorized User
 
Join Date: Dec 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Once again thank you
Actually txtloan field is not in main table in txtloan some function are there like

Public Function mmela(ByVal mela As Double) As Double
Dim mb As Double
Dim ml As Double
mb = Me.pay
ml = mb * 100
mcl = 800000
mela = ml
If mela > 800000 Then
mmela = 800000
ElseIf mela <= 800000 Then
mmela = ml
End If
End Function
So I want append all above field records in another table


Mohamed Mohiddin
Officer
 
Old January 18th, 2007, 02:29 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

You need to create a new field in the table where you want this value stored. Let's call it "Loan"

Then copy this code that calculates the value to the Before Insert AND Before Update events on the form.

Add this line to the end of the code on both of these events:

Me.Loan = mmela()

That should work.

mmcdonal
 
Old January 19th, 2007, 07:43 AM
Authorized User
 
Join Date: Dec 2003
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok but I want only one recordset to append to my another table tblLoan eg.out of 10 i want append 9th one to be append

Mohamed Mohiddin
Officer
 
Old January 19th, 2007, 08:28 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I'm sorry, now I am lost. How do you choose the record that gets appended?

mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Re-using Append Queries steve smart Access 1 May 17th, 2007 11:37 AM
append record whith do while function iisha64 Access VBA 0 February 19th, 2007 09:24 AM
How do I append a single record ??? prashanthmcr SQL Language 3 December 14th, 2005 05:40 PM
Combining Queries or results from 2 queries Ford SQL Server 2000 24 November 7th, 2005 08:54 PM
append to [email protected] VB Databases Basics 3 June 22nd, 2003 04:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.