Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2004, 12:45 PM
Registered User
 
Join Date: Sep 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Enter Parameter Value

I have two forms one displaying data for a single record. Within this form there is a combo box, the data source being another table. I want to be able to click a button on the first form that will read the value of the combo box and display the relevant record on the second form I am currently using:

DoCmd.OpenForm "Invent_Frm", , , "NAME = " & Me.Name

When I run this the message comes up 'Enter Parameter Value' I have got this method working on a continuous form the only thing I can think of is that the NAME field is not the key field but it is set not to allow duplicates.

Any help would be greatly appreciated!

Simon

 
Old November 18th, 2004, 10:02 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

For the button's On CLick event, you need to add code that looks like this:

==================================================
Private Sub btnYourButton_Click()
On Error GoTo Err_btnYourButton_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "frmYourFormName"

    stLinkCriteria = "[PrimaryKey]=" & Me![cboYourComboBox]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_btnYourButton_Click:
    Exit Sub

Err_btnYourButton_Click:
    MsgBox Err.Description
    Resume Exit_btnYourButton_Click

End Sub
================================================

Once you have the combo box on your form, if you use the button wizard, it should prompt you to open the new form based on some link criteria anyway.


mmcdonal
 
Old November 19th, 2004, 09:07 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

First a comment on mmcdonal and your code. If the name that you're searching is text, i.e. type string, then write

DoCmd.OpenForm "Invent_Frm", , , "[NAME] = '" & Me.Name & "'"

Since mmcdonal used SPECIFICALLY [PrimaryKey], which are usually numbers, his is correct assuming [PrimaryKey] is a number. However, you specified NAME which is text, which needs the single-quote delimiters.

As for the "Enter Parameter Value", check to make sure your form is not based on a query that asks for a parameter. In your query's criteria cells, check to make sure you literally don't have

[Enter Parameter Value]

in one of those cells. If you do, that's where that's coming from.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
 
Old November 26th, 2004, 12:57 PM
Registered User
 
Join Date: Sep 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your input. I looked into it and the Form was looking at a query based form I have found an other way around it.

Thanks

Simon






Similar Threads
Thread Thread Starter Forum Replies Last Post
Enter Key Event (Enter Key Only) Coby Excel VBA 0 February 6th, 2008 09:55 PM
Enter Parameter Value error dominicjn Access 4 August 16th, 2007 07:17 AM
"Enter parameter value" occurrs randomly carrie09 Access 5 April 3rd, 2007 10:47 AM
Unexpected enter parameter value lic023 Access VBA 1 March 13th, 2006 03:49 PM
How to hide "Enter Parameter Value" screen crsytal salmaan Crystal Reports 2 April 21st, 2004 11:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.