Reputation: 55
I have a form called "Label" and another form called "Sheeter". Sheeter form has 12 textboxes (Pallet1), (Pallet2), (Pallet3)...
The user will enter other details in the "Sheeter" form, but they will stay on the page till all the 12 boxes are filled up. Pallet textboxes basically captures the time at which the different pallets are made (which is for used as tracking numbers). As soon as one Pallet is made User will double click the textbox "Pallet1" and it will be populated with current time. Next the user wants to use this value in textbox Pallet1 to print a label. I have made a button which will fetch the value of Pallet1 textbox in a textbox in Label Form. The user doesn't want to close the Sheeter form at this point, and will wait on the form till the next Pallet is produced, again double click on the textbox "Pallet2" to get the time and expect that once the Print button is clicked it takes the new value to populate the textbox label on form label.
I have tried if loops of two different types, however I am unsure of the syntax.
First logic is to see if a textbox is empty and if its true fetch the value from the previous textbox for the label.
Second logic is to compare the value of the textboxes and which is higher, fetch that value.
If Me.Pallet2.Value = "" Then
Forms![LabelSHEETER1].Pallet = Me.Pallet1
Me.JOB.SetFocus
Else
If Me.Pallet3.Value = Null Then
Forms![LabelSHEETER1].Pallet = Me.Pallet2
Me.JOB.SetFocus
Else
If Me.Pallet4.Value = Null Then
Forms![LabelSHEETER1].Pallet = Me.Pallet3
Me.JOB.SetFocus
End If
End If
End If
If Me.Pallet2.Value ="" Then
Forms![LabelSHEETER1].Pallet = Me.Pallet1
Me.JOB.SetFocus
Else
If Me.Pallet2.Value >Me.Pallet1.value Then
Forms![LabelSHEETER1].Pallet = Me.Pallet2
Me.JOB.SetFocus
Else
If Me.Pallet3.Value >Me.Pallet2.value Then
Forms![LabelSHEETER1].Pallet = Me.Pallet3
Me.JOB.SetFocus
End If
End If
End If
I am unsure if I should write "" or Null, have tried both, none of them work.
Also neither of the logic seem to be working (dont know if syntax is incorrect or logic itself is flawed)
Upvotes: 0
Views: 28
Reputation: 55
Oh wait, I found the solution:
If IsNull(Me.Pallet2.Value) Then
Forms![LabelSHEETER1].Pallet = Me.Pallet1 Me.JOB.SetFocus
Else
If IsNull(Me.Pallet3.Value) Then
Forms![LabelSHEETER1].Pallet = Me.Pallet2 Me.JOB.SetFocus
Else
If IsNull(Me.Pallet4.Value) Then
Forms![LabelSHEETER1].Pallet = Me.Pallet3 Me.JOB.SetFocus
End If End If End If
Upvotes: 0