Solved

Go to a specific record in another form

Posted on 2004-09-21
6
243 Views
Last Modified: 2010-08-05
Hi,

I have a form that relates to data in another form. I want to go to the related record in the other form.

I already have the code working in another form, and it goes to the record selected as expected:

DoCmd.OpenForm "frmPIO", acNormal, "IOID=" & Me!IOID
DoCmd.Maximize
DoCmd.Close acForm, "frmIO"

I have created a click button on a different form and added similar code for the same purpose of opening another form with the record in view. BUT, when the form opens, it seems to ignore the code telling it which record to display and ALWAYS GOES TO THE FIRST RECORD.

Info:
Form with button on: frmIO
Form to open at specific record: FrmPIO
Common identifier = "IOID" - is a number field, and is on both forms.

Your help arreciated!

LoveToSpod
0
Comment
Question by:LoveToSpod
  • 3
  • 2
6 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 175 total points
ID: 12113464
This may be incredibly obvious, but in the second form, you need code in the .Open event that performs the following...

Me.Filter = Me.OpenArgs
Me.FilterOn = True

Hope this helps.
-Jim
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 12113528
Can you post the similar code that you created to open the other form?
0
 

Author Comment

by:LoveToSpod
ID: 12113541
I have entered that code in the open even of the form, and it returns error 94, Invalid use of null on the 'Me.Filter = Me.OpenArgs' line.

?!?!?
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:LoveToSpod
ID: 12113591
DoCmd.OpenForm "frmPIO", acNormal, , "IOID=" & Me!IOID
DoCmd.Maximize
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 175 total points
ID: 12113642
Note that in the code that you posted at the top, you have:
DoCmd.OpenForm "frmPIO", acNormal, "IOID=" & Me!IOID

but just above, you have:
DoCmd.OpenForm "frmPIO", acNormal, , "IOID=" & Me!IOID

In other words, one additional comma. The second syntax is actually correct and not the first, so I'm not sure why the second doesn't work (it should be the first that fails).
0
 

Author Comment

by:LoveToSpod
ID: 12113743
Gents I fiddled with it, and I discovered I didn't have the quotes "" in the code.

DoCmd.OpenForm "frmPIO", acNormal, , IOID = Me.IOID
DoCmd.OpenForm "frmPIO", acNormal, , "IOID=" & Me!IOID

Sorry, my question was incorrect, as if the quotes hadn't have been there you would have all jumped on it.

It's the devout love for MSAccess that makes me spend 10 hours constantly on the go, and after a while one get's a 'face of it' and can't see the wood for the trees. uurrrgghhh....

Thanks for your help!   ;)

LoveToSpod.

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question