Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics 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 November 26th, 2007, 03:13 AM
Registered User
 
Join Date: Nov 2007
Location: Dallas, TX, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Split form

Hi, This is my first post here.
I'd like to say that I'm new to VBA and am learning.
I have a text value (letters and numbers) that is my primary key (be nice) and I am having trouble switching from one form to another (same table). I know it has something to do with querying the record when Form2 opens (want Form1 to close when Form2 opens). I am stuck with this ID format so please don't slam me. I am able to do this when I add a "autonumber" to the table and use it in the forms. As I will have this ID in the table anyway and it will be unique to each record and will be used to relate several tables I hate to stick an autonumber in just to be able to do this. Below is the code I am currently using with the autonumber, any help would be appreciated.
I am using Access 2003
Thanks, DCC

Form1:
Private Sub cmdContinueReport_Click()
On Error GoTo MyErrorHandler

Me.mycheckbox = True

Dim lngID As Long
lngID = Me.ID 'Autonumber, would like to use text value
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "FORM2", , , "ID = " & lngID

MyErrorHandlerExit:
Exit Sub
MyErrorHandler:
MsgBox "Error Description: " & Err.Description & " Error Number: " & Err.Number
Resume MyErrorHandlerExit

End Sub


Reply With Quote
  #2 (permalink)  
Old November 26th, 2007, 08:09 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Hi there.. I don't see where is your problem.. what type of error are you receiving?? where??

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
Reply With Quote
  #3 (permalink)  
Old November 26th, 2007, 08:36 PM
Registered User
 
Join Date: Nov 2007
Location: Dallas, TX, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for looking, the problem was that I didn't want to have to add the autonumber field. I got it figured out today, had be trying to use the text value as a string but couldn't get it to work, discovered I had not been using the right combination of quotes.
This is working so thanks again. DCC
Dim strID As String
strID = Me.ID
DoCmd.Close acForm, Me.Name
DoCmd.OpenForm "FORM2", , , "[ID]= '" & strID & "'"
Reply With Quote
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
To Split or Not to Split darrenb Access 2 February 8th, 2008 12:28 PM
split() darkhalf Javascript 1 October 21st, 2005 11:34 AM
Split crmpicco VB How-To 6 May 17th, 2005 04:16 AM
split crmpicco Classic ASP Basics 2 February 14th, 2005 08:48 AM



All times are GMT -4. The time now is 08:24 PM.


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