Copying info to next record

summer

Registered User.
Local time
Today, 03:38
Joined
Oct 15, 2001
Messages
65
Here is my situation. I am creating a form in a new database. The database is for debits. One debit check may have 1 to 90 parts associated with it. We are going to start logging these into a database. The first 5 fields (MRA#, CK#, Customer#, Invoice#, and Debit Amount) may have to be re-entered into the next records depending on how many parts are associated with that debit. How can I get those first 5 fields to repeat into the next record? For example, I enter the first 5, then enter the part number, item number, quantity, cost, DMR# and date. For the next record or so, the first 5 may remain the same, but the next 6 will be different. How do I get it to copy over?
Hope this makes sense and someone can help! Be gentle, macros and expressions are very complicated to me!
 
Trouble with this in Access is that it is gently complicated and requires use of a VB Module to implement. Use the search engine for Auto fill New records in this Forum 1st, or search AutoFillNewRecords, or Fill Records. This is also explained in an MS Knowledge base article, if you are familiar with them.
If you know how to use vb its a cinch.
 
I am not familiar with VB.
I will try working with the AutoFill features.
Thanks.
 
Does anyone know if using a subform for this would work?
 
A subform is not meant for this but generally to display data from the many side of a one to many relationship.

There are several methods to achieve qhat you want. To my knowledge, the following is pretty often used:

Enter the value to carry forward in the Tag property of the contrl from which you want to copy the data, and add a command button with the following code.

Dim ctl as control
For each ctl.Tag in me.controls
if ctl.tag = "CarryForward" then
ctl.defaultvalue = ctl.value
end if
next

Alex
 
I did what you suggested. This is what I got: Complie error: Variable required - can't assign to this expression.

I entered the value in the tag property, then did a separate command button. Is there a different way I am supposed to do the command button?
Thanks for any help!
 
From the MS KnowledgeBase comes this description:
Comment:- Steps 45 onwards did not work for me, rather I change Tabstop from yes to no if this becomes a problem. You can still access yr other fields by mouse.

To create and use the AutoFillNewRecord() function, follow these steps:
1. Open the sample database Northwind.mdb.
2. Create a module and type the following line in the Declarations section:
Option Explicit
3. Type the following procedure:
4.
5. Function AutoFillNewRecord(F As Form)
6.
7. Dim RS As DAO.Recordset, C As Control
8. Dim FillFields As String, FillAllFields As Integer
9.
10. On Error Resume Next
11.
12. ' Exit if not on the new record.
13. If Not F.NewRecord Then Exit Function
14.
15. ' Goto the last record of the form recordset (to autofill form).
16. Set RS = F.RecordsetClone
17. RS.MoveLast
18.
19. ' Exit if you cannot move to the last record (no records).
20. If Err <> 0 Then Exit Function
21.
22. ' Get the list of fields to autofill.
23. FillFields = ";" & F![AutoFillNewRecordFields] & ";"
24.
25. ' If there is no criteria field, then set flag indicating ALL
26. ' fields should be autofilled.
27. FillAllFields = Err <> 0
28.
29. F.Painting = False
30.
31. ' Visit each field on the form.
32. For Each C In F
33. ' Fill the field if ALL fields are to be filled OR if the
34. ' ...ControlSource field can be found in the FillFields list.
35. If FillALLFields Or InStr(FillFields, ";" & (C.Name) & ";") > 0 Then
36. C = RS(C.ControlSource)
37. End If
38. Next
39.
40. F.Painting = True
41.
42. End Function
43. Save the module as modAuto_Fill_New_Record.
44. Open the Customers form in Design view. Change the OnCurrent property of the form to read as follows:
=AutoFillNewRecord([Forms]![Customers])
45. Add a text box to the form, and set the following properties:
46. Text Box
47. ----------------------------------------------------------
48. Name: AutoFillNewRecordFields
49. Visible: No
DefaultValue: CompanyName;ContactName;ContactTitle;Address
When you go to a new record, the CompanyName, ContactName, ContactTitle, and Address fields are filled in automatically. If you want all fields to automatically be filled in, you can leave the DefaultValue property blank or omit putting the AutoFillNewRecordFields text box on the form.
 

Users who are viewing this thread

Back
Top Bottom