Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
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 June 25th, 2009, 11:38 AM
Registered User
 
Join Date: Jun 2009
Posts: 4
Thanks: 3
Thanked 0 Times in 0 Posts
Default Open an existing record in access 2

Hello everyone,
I have a form (frmgood) and its subform (formparts2) . I designed another form (frmrecordnumber) that has a textbox (where the record number is entered by the user), and a findrecord button ( once is clicked it would open frmgood with the formparts2 at the existing record entered by the user). The record textbox on the frmgood is named IDA. The code i tried is shown below: ( i know is totally wrong)

Private Sub findrecord_Click()
Dim IntNum As Integer
Dim intID As Integer
Set intID = Forms!frmgood!frmParts2!IDA (Once run it keeps giving me 2450 error saying that the frmgood doesn't exist, eventhough it does)
Set IntNum = Me.text1
If intID = IntNum Then ( I dont know what to write to make it go to the existing record entered by the user)
Else
MsgBox "The record does not exist"
End If
End Sub
I'm , i have been trying for the last 3 days and nothing. I would really appreciate any help. Thank you. I'm using access 2002
 
Old June 26th, 2009, 12:15 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

First: Declare those integers as Long instead since that will eventually cause problems if those are autonumber fields.

Second: When you reference "Set intID = Forms!frmgood!frmParts2!IDA ", that form is not open yet. To Access, it doesn't exist. What it means is, it is not opened. You can only reference a control on a form that is open.

The other code I posted should resolve the other issues you have.
__________________
mmcdonal

Look it up at: http://wrox.books24x7.com
The Following User Says Thank You to mmcdonal For This Useful Post:
abrahom (June 26th, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't open existing web page dynosaur Visual Web Developer 2008 0 May 26th, 2009 09:26 AM
Add a new record between two existing records hsncompany BOOK: Beginning Access 2003 VBA 0 April 13th, 2008 03:36 PM
how to open an existing query in VBA michael193nj Access VBA 4 March 26th, 2008 05:09 PM
Want to insert a new record when an existing recor lionofthejungle Access 1 September 9th, 2004 11:55 AM
Check for existing record echajmovic Access 1 November 3rd, 2003 08:03 PM





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