Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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
Reply With Quote
  #2 (permalink)  
Old June 26th, 2009, 12:15 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
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
Reply With Quote
The Following User Says Thank You to mmcdonal For This Useful Post:
abrahom (June 26th, 2009)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:49 PM.


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