|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > How do I open a new record in a sub form? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|