Solved Updating continuous subform (1 Viewer)

Uldis007

New member
Local time
Today, 07:43
Joined
Nov 17, 2021
Messages
22
Hello!

I need to update the continues subform field “txtServisaVieta” after I update combobox “Combo19” in main form. I am trying to use recordset code

but the code doesn't work.

Main form: RemontaUzdevumiF

Subform: PieteikumaPamatojums_uzdevums

Can someone please help
Code:
Private Sub Combo19_AfterUpdate()

Dim rs As dao.Recordset

Set rs = Me.PieteikumaPamatojums_uzdevums.Form.RecordsetClone
With rs
If .RecordCount > 0 Then .MoveFirst
While Not .EOF
!txtServisaVieta = Me.Combo19.Value
.MoveNext
Wend
End With
Set rs = Nothing


End Sub
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,233
you need to add .Edit ... .Update to your code:

...
...
While Not .EOF
.Edit
!txtServisaVieta = Me.Combo19.Value
.Update
.MoveNext
Wend
...
...
 

Uldis007

New member
Local time
Today, 07:43
Joined
Nov 17, 2021
Messages
22
you need to add .Edit ... .Update to your code:

...
...
While Not .EOF
.Edit
!txtServisaVieta = Me.Combo19.Value
.Update
.MoveNext
Wend
...
...
Thanks for the reply!
Unfortunately it did not help. Access response : Run-time error 3265 Item not found in this collection
Code:
Dim rs As dao.Recordset

Set rs = Me.PieteikumaPamatojums_uzdevums.Form.RecordsetClone
With rs
If .RecordCount > 0 Then .MoveFirst
While Not .EOF
.Edit
!txtServisaVieta = Me.Combo19.Value ( The run-time error is in this line)
.Update
.MoveNext
Wend
End With
Set rs = Nothing
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,233
then you don't have this as a Field in your recordset:

!txtServisaVieta

you put the Fieldname, not the Textboxname.
 

Uldis007

New member
Local time
Today, 07:43
Joined
Nov 17, 2021
Messages
22
then you don't have this as a Field in your recordset:

!txtServisaVieta

you put the Fieldname, not the Textboxname.

I add the textboxname from property sheet,
1645694981546.png
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:43
Joined
May 7, 2009
Messages
19,233
use the Fielname ( Control Source) not the Textboxname

!ServisaVieta = Me.Combo19.Value
 

Uldis007

New member
Local time
Today, 07:43
Joined
Nov 17, 2021
Messages
22
use the Fielname ( Control Source) not the Textboxname

!ServisaVieta = Me.Combo19.Value
I finally understood!
It works!
I'm so clumsy.
Thank you very much for your help and time!
Have a nice day!
 

Users who are viewing this thread

Top Bottom