?
Solved

Go to a specific record in another form

Posted on 2004-09-21
6
Medium Priority
?
246 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 700 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

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

Accepted Solution

by:
shanesuebsahakarn earned 700 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Suggested Courses

770 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