Textbox Update (1 Viewer)

Rob_Jones101

Member
Local time
Today, 14:52
Joined
Aug 8, 2019
Messages
41
Hi All.

1676291562148.png


I have a checkbox at the bottom of the form. What I want is when the checkbox is clicked, all of the received textboxes to equal the units ordered textboxes. I have tried a few different methods but none seem to be working. You are able to enter data into the textboxes. However I would like the checkbox to override the data to copy what is in the ordered text boxes.

If Me.recieved.Value = True Then
Me.UnitsReceived = Me.UnitsOrdered
End If

That is some basic code that i thought would work but looking online it looks a bit more complicated than that. All that code does it make the last line of the form copy the units ordered number to the units received. I want all of them to change when the check box is ticked.

Any help would be appreciated.

Thanks.
 

Ranman256

Well-known member
Local time
Today, 09:52
Joined
Apr 9, 2015
Messages
4,337
then you want to run an update query:
Code:
If Me.received.Value = True Then
    docmd.openquery "quUpdMyList
End If

sql like:
update table set UnitsRecevied = UnitsOrdered where [Received]=true
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 21:52
Joined
May 7, 2009
Messages
19,245
Code:
With Me.RecordsetClone
    If Not (.BOF And .EOF) Then
        .MoveFirst
    End If
    Do Until .EOF
        .Edit
        !UnitsReceived = !UnitsOrdered
        .Update
        .MoveNext
     Loop
End With
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 09:52
Joined
Feb 19, 2002
Messages
43,293
Using an action query is always better than using a DAO loop. Except that @Ranman256 's query probably needs additional criteria to limit it to the PO shown on the form.
 

Users who are viewing this thread

Top Bottom