D
D
Doctorz2016-08-05 00:54:07
SQL
Doctorz, 2016-08-05 00:54:07

How to copy data from one form field to another form field access?

There is a form1 in it there is a Field1. After pressing the button, Form2 opens in which there is a Field2. It is necessary that the data from Field1 of form1 be copied to Field2 of form2. How can such a thing be implemented?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Артём Каретников, 2016-08-05
@art_karetnikov

Ai wei ... Generally a childish question. It can be implemented in at least three ways.
Personally, in order not to knock down my hand, I pass it through the form parameters.
' collect the string to be passed to the edit form
strOpenParam = me.txt_id & "#"
DoCmd.OpenForm "frmLocationAddEdit", acNormal, , , , acDialog, strOpenParam
Where me.txt_id is the same field. And "#" is a separator.
If you need more parameters, you pass them in the same way, adding a separator.
And in Form 2 you do this:
Private Sub Form_Open(Cancel As Integer)
Dim searchArgument As String
searchArgument = Nz(OpenArgs, "")
If Len(searchArgument) = 0 Then
MsgBox "The open arguments are not correctly transferred ", vbInformation
Cancel = True
Exit Sub
End If
me.id_form = Split(OpenArgs, "#")(0)
This method has one but serious drawback. The separator, in this case # must not be present in the passed string. Therefore, choose a different separator for yourself - and control the transmitted string before opening the second form.
Its advantage is that it is convenient to transfer a bunch of data at once, clearly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question