transfer information between forms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

First question:
I am new to creating forms in access. I am trying to allow the user to enter
information in the first form which will then be transferred to the following
forms (after clicking on a button to close and open ththe next form). I have
tried

DoCmd.OpenForm "Form1b", , , "[ProvinceID] = " & Me.ProvinceID

but get the following error "the expression you entered refers to an object
that is closed or doesn't exist".

Second question:
When I press my "back" button on Form1b, I want to be able to go back to the
information that was entered on Form1a. But it reverts back to the data in
the first row of the source data.

Any tips? (I am guessing these two questions are closely related).

Thanks,
Ronnie.
 
but get the following error "the expression you entered refers to an
object
that is closed or doesn't exist".

you have to open the second form *before* you close the first form, because
the WHERE clause in the OpenForm action refers to a control on the first
form.
When I press my "back" button on Form1b, I want to be able to go back to the
information that was entered on Form1a. But it reverts back to the data in
the first row of the source data.

if you're talking about the built-in Navigation buttons on the form, then
that would be the expected result. the Navigation buttons act on the
RecordSource of the bound form. in order to return to the first form, you'll
need to add a command button to the form, and use a macro or VBA code to go
back to the first form.

hth


Ronnie said:
Hello,

First question:
I am new to creating forms in access. I am trying to allow the user to enter
information in the first form which will then be transferred to the following
forms (after clicking on a button to close and open ththe next form). I have
tried

DoCmd.OpenForm "Form1b", , , "[ProvinceID] = " & Me.ProvinceID

but get the following error "the expression you entered refers to an object
that is closed or doesn't exist".

Second question:
When I press my "back" button on Form1b, I want to be able to go back to the
information that was entered on Form1a. But it reverts back to the data in
the first row of the source data.

Any tips? (I am guessing these two questions are closely related).

Thanks,
Ronnie.
 
Ronnie said:
Hello,

First question:
I am new to creating forms in access. I am trying to allow the user to enter
information in the first form which will then be transferred to the following
forms (after clicking on a button to close and open ththe next form). I have
tried

DoCmd.OpenForm "Form1b", , , "[ProvinceID] = " & Me.ProvinceID

but get the following error "the expression you entered refers to an object
that is closed or doesn't exist".

Second question:
When I press my "back" button on Form1b, I want to be able to go back to the
information that was entered on Form1a. But it reverts back to the data in
the first row of the source data.

Any tips? (I am guessing these two questions are closely related).

Thanks,
Ronnie.

form1 must be open for form2 to find the information in form1.
If you close form1, there is no information!
Don't close form1,just open form2. Then close form1 from the OnOpen
event of form2.

Reverse the order of things to open form1 from form2. then put the close
event of form2 on the onopen event of form one wrapped in an if form2 is
open routine.

If CurrentProject.AllForms("form2").IsLoaded Then
'Your code here...
Else
'Your other code here...
End If

Hope this helps!

Jeff C
 
Back
Top