Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Go to a specific record in another form

Posted on 2004-09-21
6
Medium Priority
?
247 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

636 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