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
> Changing Multiple Records In A Subform From A Data Source In Main Form, Access 2016    
 
   
ollyhutsy
post Oct 16 2019, 05:52 AM
Post#1



Posts: 64
Joined: 16-October 19
From: United Kingdom


I am trying to update a yes/no field in a subform by clicking a recieved button in the main form. At the moment I am using the following code : Forms![Blacking Parts Received]![Job Detail subform].Form![SubContractRecieved] = -1 in the on click command of the button on visual basic. This will update only the first record in the subform. I was wondering how i would loop this to change all the values to -1 in the field for every record displayed in the subform.
Go to the top of the page
 
arnelgp
post Oct 16 2019, 05:57 AM
Post#2



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


CODE
With Me.[Job Detail subform].Form.RecordClone
    If Not (.BOF And .EOF) Then .MoveFirst
    While Not .EOF
         .Edit
         ![SubContractRecieved] = -1
         .Update
         .MoveNext
    Wend
End With

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 
ollyhutsy
post Oct 16 2019, 06:01 AM
Post#3



Posts: 64
Joined: 16-October 19
From: United Kingdom


No luck, run time error: 2465 object defined error
Go to the top of the page
 
ollyhutsy
post Oct 16 2019, 06:14 AM
Post#4



Posts: 64
Joined: 16-October 19
From: United Kingdom


The second line of code is highlighted on the debugger.
Go to the top of the page
 
projecttoday
post Oct 16 2019, 06:14 AM
Post#5


UtterAccess VIP
Posts: 11,250
Joined: 10-February 04
From: South Charleston, WV


In case olly hutsy didn't catch it, I think it should be RecordsetClone not RecordClone.

--------------------
Robert Crouser
Go to the top of the page
 
ollyhutsy
post Oct 16 2019, 06:17 AM
Post#6



Posts: 64
Joined: 16-October 19
From: United Kingdom


Perfect, Thanks a lot.
Go to the top of the page
 
arnelgp
post Oct 16 2019, 06:18 AM
Post#7



Posts: 1,510
Joined: 2-April 09
From: somewhere out there...


yes, RecordsetClone.
typing without intellisense.

--------------------
Never stop learning, because life never stops teaching.
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    7th December 2019 - 02:18 AM