Solved

Go to a specific record in another form

Posted on 2004-09-21
6
239 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

708 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now