Updating continuous subform

deepcec9

Registered User.
Local time
, 18:08
Joined
Oct 7, 2015
Messages
33
Need to update subform (continuous form)field from value from main form.
Main form filed "truckno"
Subform field "truckno_out"

tried the code
Me.out_Subform.Form.truckno_out = Me.truckno.Value

but it updates only first record.
Is there any way I can update all the line of records in subform using vb
TIA
 
On some form event use an update query.

PHP:
docmd.RunSQL "UPDATE YOURTABLENAME SET TRUCKNO_OUT ='" & ME.TRUCKNO & "'"

THIS ASSUMES THAT TRUCKNO IS A STRING, IF NUMERIC OMIT THE ' (TIC).

Note that subform records are updated one row at a time.
 
that updates thevalue to table directly, I would like to update the value to subform filed first and after saving the subform updating it into table.

In short need to show the "truckno" value from main form to "truckno_out" in subform (continuos).

Thank you
 
you have to use the recordset of your subform:

dim rs as dao.recordset

set rs=Me.out_Subform.Form.RecordsetClone
with rs
if .recordcount>0 then .movefirst
while not .eof
![truckno out] = Me.truckno.Value
.movenext
wend
end with
set rs=nothing
 

Users who are viewing this thread

Back
Top Bottom