Passing a Value to my Subform and Create a new Record.

  • Thread starter CW via AccessMonster.com
  • Start date
C

CW via AccessMonster.com

I have the following code behind the After Update event of my Option Group:
-----------------------------------------------------------
Private Sub Frame15_AfterUpdate()
Dim strRetVal As String
Select Case Me.Frame15
Case Is = 1
strRetVal = "1"
Me.TabCtl0 = TabCtl0 + 1
Case Is = 2
strRetVal = "2"
Me.TabCtl0 = TabCtl0 + 1
Case Is = 3
strRetVal = "3"
Me.TabCtl0 = TabCtl0 + 1
Case Is = 4
strRetVal = "4"
Me.TabCtl0 = TabCtl0 + 2
Case Is = 5
strRetVal = "5"
Me.TabCtl0 = TabCtl0 + 3
Case Is = 6
strRetVal = "6"
Me.TabCtl0 = TabCtl0 + 4
End Select
Me!sfrmqryMainTeleService!Combo104 = strRetVal

End Sub
----------------------------------------------------------

Right now, the last line in my code will open up the Subform, but if a record
already exists in the Subform, it overwrites the value that is in the
Combo104 dropdown.

What I want it to do is:
1) Open the subform, create a new record using strRetVal as the value for the
Combo104 dropdown which is on my sfrmqryMainTeleService.

Hope this makes sense.
Thanks in advance for your help.
cw
 
C

cw via AccessMonster.com

I fixed my problem by getting rid of the Option group, and adding separate
Command buttons with this code:
--------------------------------------------------------------------
Private Sub Command356_Click()
On Error GoTo Err_Command356_Click
Me.TabCtl0 = TabCtl0 + 1
DoCmd.GoToRecord , , acNewRec
sfrmqryMainTeleService!Combo104 = 1

Exit_Command356_Click:
Exit Sub

Err_Command356_Click:
MsgBox Err.Description
Resume Exit_Command356_Click
End Sub
-------------------------------

Thanks anyway,
cw
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top