By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,121 Members | 1,723 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,121 IT Pros & Developers. It's quick & easy.

Opening Form and Moving to Selected Record

P: 47
Hi friends,

I want a script that will move a form to a chosen record.

Here's what I'm trying:

I get the parameter from la different form using Docmd,openform using openargs

I've been trying docmd.gotocontrol followed by docmd.findrecord, but I keep getting complier errors. Here's my code:

Expand|Select|Wrap|Line Numbers
  1.    If Len(Nz(Me.OpenArgs, "")) > 0 Then
  2.     DoCmd.GoToControl "MemNo"
  3.     DoCmd.FindRecord OpenArgs, , , , , acCurrent
  4. End If
It crashes on the first DoCmd command.

Please help.


(note that 'DoCmd.OpenForm stDocName, , , stLinkCriteria will not work for this application. That limits the records in the form to those meeting the criteria; I need my user to be able to access other records. )
Dec 16 '08 #1
Share this Question
Share on Google+
4 Replies

Expert 2.5K+
P: 3,532
Where is your current code placed?

Linq ;0)>
Dec 16 '08 #2

P: 47
Hi Linq,

This code is in the OnLoad of the destination form.

Here's the whole thing:

Private Sub Form_Load()
If Len(Nz(Me.OpenArgs, "")) > 0 Then
DoCmd.GoToControl "MemNo"
DoCmd.FindRecord OpenArgs, , , , , acCurrent
End If
End Sub

Thanks Linq.
Dec 17 '08 #3

P: 47
Call off the dogs!

Now it works, and I know why.

Thanks anyway Linq and all others who''ve tried

Dec 17 '08 #4

Expert 2.5K+
P: 3,532
Glad you got it working! Forum etiquette, here and elsewhere, dictates when the original poster solves the problem "off-line" that they post the solution. That way, others with similar problems, who come searching and find the thread, can also be helped.

Linq ;0)>
Dec 17 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.