Selecting a record on 1 form based on another form using a button

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

Guest

Hi everyone
I am trying to set a button that runs off a macro on form1 that opens form2
and goes to the specific record that was selected on form1.

Here's the set-up:
Forms "IF_assignaccount" and "AF_projectstatus" are based on queries
(projectstatus has a preexisting filter from the query
(((AF_ProjectStatus.Closed=-1))) AND ((AF_ProjectStatus.Closed=-1))

The command button created on the "projectstatus" form was set to run the
following macro:

-openform
Name:IF_Assignaccount
View:Form
Filter:
WhereCondition:[Forms]![AF_ProjectStatus]![ProjectAccessionNumber]=[Forms]![IF_AssignAccount]![ProjectAccessionNumber]
DataMode:
WindowMode:Normal
-MoveSize
-beep

When I excute the button, The form appears and is set at the correct
location and the system beeps. However, The form does not select the
specific record and has no data (structure, fields etc are all there, just no
data). I have tried adjusting different properties on form2 to get the
matched record to show up but no dice.

Any steerage would be helpful.....Thanks to all !!!!
 
When I excute the button, The form appears and is set at the correct
location and the system beeps. However, The form does not select the
specific record and has no data (structure, fields etc are all there, just no
data). I have tried adjusting different properties on form2 to get the
matched record to show up but no dice.

The where-condition isn't searching for data on a Form - it's searching for
data in a Table. Data is not stored on forms! It's stored in tables; the form
is just a window.

Making some guesses about the structure of your database, try

Name:IF_Assignaccount
View:Form
Filter:
WhereCondition:[ProjectAccessionNumber]=[Forms]![YourMainForm]![ProjectAccessionNumber]
DataMode:
WindowMode:Normal
-MoveSize
-beep

This will look on the form named YourMainForm (change this to the name of the
form that you're opening IF_Assignaccount *from*) for the value of the
ProjectAccessionNumber.

John W. Vinson [MVP]
 
Hi John
Was out on vaction....it worked ....thanks!!
Luis

John W. Vinson said:
When I excute the button, The form appears and is set at the correct
location and the system beeps. However, The form does not select the
specific record and has no data (structure, fields etc are all there, just no
data). I have tried adjusting different properties on form2 to get the
matched record to show up but no dice.

The where-condition isn't searching for data on a Form - it's searching for
data in a Table. Data is not stored on forms! It's stored in tables; the form
is just a window.

Making some guesses about the structure of your database, try

Name:IF_Assignaccount
View:Form
Filter:
WhereCondition:[ProjectAccessionNumber]=[Forms]![YourMainForm]![ProjectAccessionNumber]
DataMode:
WindowMode:Normal
-MoveSize
-beep

This will look on the form named YourMainForm (change this to the name of the
form that you're opening IF_Assignaccount *from*) for the value of the
ProjectAccessionNumber.

John W. Vinson [MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top