Textbox Update

Rob_Jones101

Member
Local time
Today, 14:00
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.
 
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
 
Code:
With Me.RecordsetClone
    If Not (.BOF And .EOF) Then
        .MoveFirst
    End If
    Do Until .EOF
        .Edit
        !UnitsReceived = !UnitsOrdered
        .Update
        .MoveNext
     Loop
End With
 
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

Back
Top Bottom