Link to home
Start Free TrialLog in
Avatar of LoveToSpod
LoveToSpodFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Go to a specific record in another form

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
SOLUTION
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Can you post the similar code that you created to open the other form?
Avatar of LoveToSpod

ASKER

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.

?!?!?
DoCmd.OpenForm "frmPIO", acNormal, , "IOID=" & Me!IOID
DoCmd.Maximize
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.