UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Copy First Record Down On Subform, Access 2016    
 
   
ollyhutsy
post Nov 8 2019, 03:59 AM
Post#1



Posts: 40
Joined: 16-October 19



I am currently trying to create a button which will copy the first line of a grn number into the remaining records in a subform. This is because items which are received are normally booked in at the same time, but not always. I am wanting to be able to click a button to copy the grn record in the first line down for the remaining records.

Private Sub CopyDown()
With Me.[supptrn subform3].Form.RecordsetClone
If Not (.BOF And .EOF) Then .MoveFirst
While Not .EOF
.Edit
![GRN] = ![GRN]
.Update
.MoveNext
Wend
End With
End Sub
Go to the top of the page
 
ollyhutsy
post Nov 8 2019, 05:16 AM
Post#2



Posts: 40
Joined: 16-October 19



Solved using the following code for anyone with a similar issue

Dim A As String
Dim B As String
Dim C As String
A = [supptrn subform3]![GRN]
B = [supptrn subform3]![Booked In By]
C = [supptrn subform3]![Date In]
With Me.[supptrn subform3].Form.RecordsetClone
If Not (.BOF And .EOF) Then .MoveFirst
While Not .EOF
.Edit
![GRN] = A
![Booked In By] = B
![Date In] = C
.Update
.MoveNext
Wend
End With
Go to the top of the page
 
Jeff B.
post Nov 8 2019, 09:06 AM
Post#3


UtterAccess VIP
Posts: 10,326
Joined: 30-April 10
From: Pacific NorthWet


I'm not sure I understand your description. It sounds like you're saying you want to have (some of) the same data stored in a 'parent' record also stored in any related 'child' records. If so, reconsider your design. In a well-normalized relational database, you would NOT want to do that. Instead, the primary key of the parent record would be stored, as a 'foreign key' in each related child record, pointing back to the parent that "owns" the child record.

--------------------
Regards

Jeff Boyce
Microsoft Access MVP (2002-2015)

Mention of hardware or software is, in no way, an endorsement thereof. The FTC of the USA made this disclaimer necessary/possible.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    17th November 2019 - 03:56 PM