![]() |
|
|
#1
|
|||
|
|||
|
I would like to call a record using a query to fill a form.
After displaying the data on a form I will change one field and save the record back to the table as a new record. I have tried several methods and none seems to work. If I call up the record in edit mode and then save it then I lose the original record. Here is my question. Does anyone have some code that will perform this operation or direct me to a resource that will help. Thanks for any assistance. B Hall |
|
#2
|
|||
|
|||
|
Ideally you would probably want to use an unbound form. I cam up with this pretty quickly to use on a bound form, but it is very inelegant and I would hold out for a better solution if you have the time.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer)
With DoCmd
.SetWarnings False
.RunSQL "INSERT INTO MyTable (text1, text2, num1, num2) SELECT '" & Me![text1] & _
"' AS Expr1, '" & Me![text2] & "' AS Expr2, " & Me![num1] & " AS Expr3, " & _
Me![num2] & " AS Expr4"
.SetWarnings True
End With
Me.Undo
Cancel = True
End Sub
|
|
#3
|
|||
|
|||
|
Patrick,
Thanks, I will give it a try. I found an alternative that is also inelegant. The concept I was working on is to allow my sales department to have the ability to call up a standard quote, review it, edit it if needed and assign a new quote number. I created a table that has only the standard quotes. I open that table , retrieve the record required , edit as required, assign a new quote number. When the salesman clicks on the finished button the record is saved back to its table, and an append query adds the record to the other table that is used for history and printing and emailing of the quote to a customer. It seems to be working okay but I prefer to do it similar to what you propose. Bob |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How can I automatically copy a record entered in one form to another form | kabichan | Access | 0 | 11-10-2008 09:32 AM |
| How to move copy queries and reports. | Fred C | Access | 1 | 11-08-2008 07:24 AM |
| Need to copy data from one textfield to another? | ashiers | Forms | 0 | 09-21-2008 09:28 AM |
| Macro to copy a record and paste within a table? | weatheri | Access | 1 | 10-27-2006 04:55 AM |
| Making a backup copy of table or database | wasim_sono | Access | 0 | 03-09-2006 02:44 AM |