|
 |
access thread: VBA for Access
Message #1 by "Vivin Deshpande" <vdeshpande@m...> on Wed, 28 Aug 2002 14:50:25
|
|
Hi,
I am working on an Access form. The form has a drop down box and an update
button. The user selects the order number from the drop down box and
clicks the update button. On Click the following event shud take place.
1. Open the Order table
2. Select all the line items corresponding to the Order number chosen by
the user from the drop down box.
3. Open another table "temp" which has the updated information for that
particular Order number and select all the data records inside.
4. Update the Order table with the records in the temp table.
Due to the business rules i cannot simply delete the old records and add
new ones at the end of the table. I have to update the exisitng records in
the Order table.
I am thinking of writing some VBA code. Cud anybody provide me with some
sample code - I m pretty new to Access and i have to no clue about VBA.
Your help would be greatly appreciated
Thank you
Vivin
Message #2 by "Carnley, Dave" <dcarnley@a...> on Wed, 28 Aug 2002 09:55:59 -0500
|
|
ewe cud yuze ey kweeree dat axepted da oarder digies az a pramter an den dit
da whupdate buhtween da deuce tabels. Dat weigh awl ewe needz iz a mack-row!
I think my keyboard is broken or something!
-----Original Message-----
From: Vivin Deshpande [mailto:vdeshpande@m...]
Sent: Wednesday, August 28, 2002 9:50 AM
To: Access
Subject: [access] VBA for Access
Hi,
I am working on an Access form. The form has a drop down box and an update
button. The user selects the order number from the drop down box and
clicks the update button. On Click the following event shud take place.
1. Open the Order table
2. Select all the line items corresponding to the Order number chosen by
the user from the drop down box.
3. Open another table "temp" which has the updated information for that
particular Order number and select all the data records inside.
4. Update the Order table with the records in the temp table.
Due to the business rules i cannot simply delete the old records and add
new ones at the end of the table. I have to update the exisitng records in
the Order table.
I am thinking of writing some VBA code. Cud anybody provide me with some
sample code - I m pretty new to Access and i have to no clue about VBA.
Your help would be greatly appreciated
Thank you
Vivin
Message #3 by Beth Moffitt <BethMoffitt@i...> on Wed, 28 Aug 2002 10:05:59 -0500
|
|
What's scarier is that I understood your reply!
-----Original Message-----
From: Carnley, Dave [mailto:dcarnley@a...]
Sent: Wednesday, August 28, 2002 9:56 AM
To: Access
Subject: [access] VBA for Access
ewe cud yuze ey kweeree dat axepted da oarder digies az a pramter an den dit
da whupdate buhtween da deuce tabels. Dat weigh awl ewe needz iz a mack-row!
I think my keyboard is broken or something!
-----Original Message-----
From: Vivin Deshpande [mailto:vdeshpande@m...]
Sent: Wednesday, August 28, 2002 9:50 AM
To: Access
Subject: [access] VBA for Access
Hi,
I am working on an Access form. The form has a drop down box and an update
button. The user selects the order number from the drop down box and
clicks the update button. On Click the following event shud take place.
1. Open the Order table
2. Select all the line items corresponding to the Order number chosen by
the user from the drop down box.
3. Open another table "temp" which has the updated information for that
particular Order number and select all the data records inside.
4. Update the Order table with the records in the temp table.
Due to the business rules i cannot simply delete the old records and add
new ones at the end of the table. I have to update the exisitng records in
the Order table.
I am thinking of writing some VBA code. Cud anybody provide me with some
sample code - I m pretty new to Access and i have to no clue about VBA.
Your help would be greatly appreciated
Thank you
Vivin
Message #4 by "Gerald, Rand" <RGerald@u...> on Wed, 28 Aug 2002 10:07:03 -0500
|
|
I thought for a minute that you had been transferred to Arkansas.
8-)
Rand E Gerald
Database Specialist
Information Services / Operations
Bah=E1'=ED National Office
1233 Central St.
Evanston IL 60201
(xxx) xxx-xxxx
-----Original Message-----
From: Carnley, Dave [mailto:dcarnley@a...]
Sent: Wednesday, August 28, 2002 9:56 AM
To: Access
Subject: [access] VBA for Access
ewe cud yuze ey kweeree dat axepted da oarder digies az a pramter an
den dit
da whupdate buhtween da deuce tabels. Dat weigh awl ewe needz iz a
mack-row!
I think my keyboard is broken or something!
-----Original Message-----
From: Vivin Deshpande [mailto:vdeshpande@m...]
Sent: Wednesday, August 28, 2002 9:50 AM
To: Access
Subject: [access] VBA for Access
Hi,
I am working on an Access form. The form has a drop down box and an
update
button. The user selects the order number from the drop down box and
clicks the update button. On Click the following event shud take place.
1. Open the Order table
2. Select all the line items corresponding to the Order number chosen
by
the user from the drop down box.
3. Open another table "temp" which has the updated information for that
particular Order number and select all the data records inside.
4. Update the Order table with the records in the temp table.
Due to the business rules i cannot simply delete the old records and
add
new ones at the end of the table. I have to update the exisitng records
in
the Order table.
I am thinking of writing some VBA code. Cud anybody provide me with
some
sample code - I m pretty new to Access and i have to no clue about VBA.
Your help would be greatly appreciated
Thank you
Vivin
Message #5 by "Carnley, Dave" <dcarnley@a...> on Wed, 28 Aug 2002 10:17:28 -0500
|
|
houcked awn foniiqs whirct 4 me!
-----Original Message-----
From: Beth Moffitt [mailto:BethMoffitt@i...]
Sent: Wednesday, August 28, 2002 10:06 AM
To: Access
Subject: [access] RE: VBA for Access
What's scarier is that I understood your reply!
-----Original Message-----
From: Carnley, Dave [mailto:dcarnley@a...]
Sent: Wednesday, August 28, 2002 9:56 AM
To: Access
Subject: [access] VBA for Access
ewe cud yuze ey kweeree dat axepted da oarder digies az a pramter an den dit
da whupdate buhtween da deuce tabels. Dat weigh awl ewe needz iz a mack-row!
I think my keyboard is broken or something!
-----Original Message-----
From: Vivin Deshpande [mailto:vdeshpande@m...]
Sent: Wednesday, August 28, 2002 9:50 AM
To: Access
Subject: [access] VBA for Access
Hi,
I am working on an Access form. The form has a drop down box and an update
button. The user selects the order number from the drop down box and
clicks the update button. On Click the following event shud take place.
1. Open the Order table
2. Select all the line items corresponding to the Order number chosen by
the user from the drop down box.
3. Open another table "temp" which has the updated information for that
particular Order number and select all the data records inside.
4. Update the Order table with the records in the temp table.
Due to the business rules i cannot simply delete the old records and add
new ones at the end of the table. I have to update the exisitng records in
the Order table.
I am thinking of writing some VBA code. Cud anybody provide me with some
sample code - I m pretty new to Access and i have to no clue about VBA.
Your help would be greatly appreciated
Thank you
Vivin
Message #6 by Beth Moffitt <BethMoffitt@i...> on Wed, 28 Aug 2002 10:24:54 -0500
|
|
LOL!!
-----Original Message-----
From: Carnley, Dave [mailto:dcarnley@a...]
Sent: Wednesday, August 28, 2002 10:17 AM
To: Access
Subject: [access] RE: VBA for Access
houcked awn foniiqs whirct 4 me!
-----Original Message-----
From: Beth Moffitt [mailto:BethMoffitt@i...]
Sent: Wednesday, August 28, 2002 10:06 AM
To: Access
Subject: [access] RE: VBA for Access
What's scarier is that I understood your reply!
-----Original Message-----
From: Carnley, Dave [mailto:dcarnley@a...]
Sent: Wednesday, August 28, 2002 9:56 AM
To: Access
Subject: [access] VBA for Access
ewe cud yuze ey kweeree dat axepted da oarder digies az a pramter an den dit
da whupdate buhtween da deuce tabels. Dat weigh awl ewe needz iz a mack-row!
I think my keyboard is broken or something!
-----Original Message-----
From: Vivin Deshpande [mailto:vdeshpande@m...]
Sent: Wednesday, August 28, 2002 9:50 AM
To: Access
Subject: [access] VBA for Access
Hi,
I am working on an Access form. The form has a drop down box and an update
button. The user selects the order number from the drop down box and
clicks the update button. On Click the following event shud take place.
1. Open the Order table
2. Select all the line items corresponding to the Order number chosen by
the user from the drop down box.
3. Open another table "temp" which has the updated information for that
particular Order number and select all the data records inside.
4. Update the Order table with the records in the temp table.
Due to the business rules i cannot simply delete the old records and add
new ones at the end of the table. I have to update the exisitng records in
the Order table.
I am thinking of writing some VBA code. Cud anybody provide me with some
sample code - I m pretty new to Access and i have to no clue about VBA.
Your help would be greatly appreciated
Thank you
Vivin
Message #7 by "Marcelo R. Lopez, Jr." <mis@p...> on Thu, 29 Aug 2002 02:32:36
|
|
Vivin,
While this won't give you a complete answer, I hope you've got enough
background in programming that this should at least set you on your course.
Forgive any typo's or such.
--------------------------------------------------------------------
Private Sub OnClickUpdateOrder()
Dim iOrderNumber As String
Dim strSQL as String
Dim rsOrders As RecordSet
Dim rsUpdateInfo As RecordsSet
iOrderNumber = ComboBoxWithOrderNumber
'( You could?ve named it whatever you want )
strSQL = "SELECT * FROM OrdersTable WHERE OrdersTable.OrderNumber = "
strSQL = strSQL & iOrderNumber
' This query will return you the records that belong to this OrderNumber
Set rsOrders = CurrentDb.OpenRecordset( strSQL )
' I am assuming that you already have a some data structure with the
' information you're going to use to update the orders with...
Set rsUpdateInfo = CurrentDb.OpenRecordSet( "SELECT * FROM tempOrders" )
'Without knowing how the records map to one another
'here is a quick snapshot at a record to record mapping
'where the first record from the "temp" table will update ALL
'records from the original table, with it's information
' Mind you, I'm not doing ANY error checking here.....
rs.MoveFirst
Do While Not rs.EOF
With rs
'Update your fields like this...
.Address1 = rsUpdateInfo![NewAddress1]
.Address2 = rsUpdateInfo![NewAddress2]
.ZipCode = rsUpdateInfo![NewZipCode]
.CreditCardNum = rsUpdateInfo![CreditCardNumber]
End With
rs.Update ' Updates the data in the record in the database
rs.MoveNext
Loop
rs.Close
End Sub
---------------------------------------------------------------------
|
|
 |