Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 August 4th, 2003, 11:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 126
Thanks: 5
Thanked 0 Times in 0 Posts
Default Filtering within code

Good morning all,
I have a set of code to open a form to a specific record. I get a runtime error saying "Object required". My code is listed below. Can anyone help me with this please?

Private Sub cmdEditPartNumber_Click()
Dim InputPartNumber As String
InputPartNumber = InputBox("Please enter the Part Number")
DoCmd.OpenForm "SpecForm", acNormal, , Parts!PartNumber = InputPartNumber, acFormEdit, acWindowNormal

End Sub


Regards,
Laura

The only thing standing between you and your goal is doubt. Quit doubting yourself and you'll be able to accomplish anything!
__________________
Regards,
Laura

The only thing standing between you and your goal is doubt. Quit doubting yourself and you'll be able to accomplish anything!
 
Old August 4th, 2003, 11:42 AM
Authorized User
 
Join Date: Jun 2003
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to change your WHERE portion of the code to be .....

"PartNumber =" & InputPartNumber & "'"

This should fix you right up

John
 
Old August 4th, 2003, 11:49 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

Laura, try this (extra code in bold):

Code:
Private Sub cmdEditPartNumber_Click()

   Dim InputPartNumber As String, Criteria as String

   InputPartNumber = InputBox("Please enter the Part Number")
   Criteria = "[Part No. Field] = '" & InputPartNumber & "'"
   DoCmd.OpenForm "SpecForm", acNormal, , Criteria, _
                  acFormEdit, acWindowNormal

End Sub
Make sure you substitute [Part No. Field] with the actual part number field name.


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use OR during filtering..... raaj81 Reporting Services 0 July 30th, 2008 05:34 AM
filtering with dates pettrer ASP.NET 2.0 Basics 1 September 13th, 2007 01:19 PM
Problem Filtering Morteza_M Pro VB Databases 2 January 23rd, 2007 08:12 AM
filtering datalist from within pettrer ASP.NET 2.0 Basics 2 August 11th, 2006 02:08 PM
Filtering data by code rodrigoss BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 2 June 23rd, 2004 02:06 PM





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