Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 26th, 2003, 02:58 PM
Jacob-Bushnell Jacob-Bushnell is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Location: North Idaho
Posts: 1 Jacob-Bushnell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question How do I open a new record in a sub form?

Hi, I have this code I am using in one form to open a "sub" form in MS access 2002.
It calls the ID (LngFamilyID) and if the the sub form has that ID it opens it.
My problem is when the sub form does not have that paticular ID it opens the first record.
How do I make it so IF there is no ID matching THEN go to the end of the record set, make a new record AND put the ID from the originating form in to the ID of the new record I just created.

Clear as mud?
Any way, here is my code I am using to open it right now.

AdoptFam is the name of the Check Box

Private Sub Command116_Click()
If AdoptFam = True Then
DoCmd.OpenForm "FrmAdoptF", acNormal, , , , , Me!LngFamilyID.Value
Else
End If
End Sub

'And the code for the ID of the sub form...


Private Sub Form_Open(Cancel As Integer)

Dim strFamID As String
If Not IsNull(Forms!FrmAdoptF.OpenArgs) Then
strFamID = Forms!FrmAdoptF.OpenArgs
If Len(strFamID) > 0 Then
DoCmd.GoToControl "FamilyID"
DoCmd.FindRecord strFamID, , True, , True, , True
End If
End If
End Sub

Thanks a lot, Jacob
Comments on this post
Gran Roguismo agrees!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > How do I open a new record in a sub form?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway