I created a Form for Vehicle reservation where I have a field where the user must enter the destination of the trip. The user may also need more than one destination, so I created an add_destino button that makes inserting textbox into the Form for each additional destination.
The problem is that when inserting a Textbox in Record 1 this action is reflected in all other records already registered (I was only able to "if Form_newrecord = true" for the TextBox to be removed). So when I go to any other record and I delete some Textbox with the button del_destino, again, the Textbox of the other registers add together, even having content.
How can I avoid this problem.
In addition, how can I save the Form state so that when it is opened again the Text box is there if it has been activated?
I hope I was not too confused.
Private Sub addPassageiro_Click()
' Botão que adiciona passageiros à requisição
If txtQtdPass < 19 Then
cont = cont + 1
txtQtdPass = cont
' checar se cont é par o ímpar
If cont Mod 2 = 0 Then
Me.Controls("passageiro" & cont).Top = Me.Controls("passageiro" & cont).Top + 200 * cont
Me.Controls("passageiro" & cont + 1).Top = Me.Controls("passageiro" & cont + 1).Top + 200 * cont
Me.Form.InsideHeight = Me.Form.InsideHeight + 400
lblsaida.Top = lblsaida.Top + 400
Saida.Top = Saida.Top + 400
Destino.Top = Destino.Top + 400
Destino1.Top = Destino1.Top + 400
Destino2.Top = Destino2.Top + 400
Destino3.Top = Destino3.Top + 400
lblmoto.Top = lblmoto.Top + 400
Motorista.Top = Motorista.Top + 400
lblveiculo.Top = lblveiculo.Top + 400
Veiculo.Top = Veiculo.Top + 400
lblinfo.Top = lblinfo.Top + 400
Infos.Top = Infos.Top + 400
End If
Else
MsgBox "Não é possível adicionar mais passageiros"
End If
End Sub