I need help with error 2448: You can't assign value to this object. What I am trying to do is allow user to select event id and race id from combo option. Once the user selects those, then the id associated with those is suppose to be carried over to a new form which should associated those two ids with runner id from runner table. Thus, I will have all three ids in event-race-runner table (which is an associative table). However when I do that I get the error message which does not let me insert the ids into this new table. I have attached the codes below. All id are number. The main table ids were generated automatically.
This is the code which should carry the ids:
Private Sub cmdAddRaceRunne r_Click()
DoCmd.OpenForm "Input Runner for race", , , , acFormAdd, , OpenArgs:=cmbEr Eventid & "|" & cmbErRaceid
end sub
this is the form which should have assigned the id into the new table:
I have use extra variable because I thought I had to convert the text into integer before assigning. any help would be appreciated to solve the problem.
This is the code which should carry the ids:
Private Sub cmdAddRaceRunne r_Click()
DoCmd.OpenForm "Input Runner for race", , , , acFormAdd, , OpenArgs:=cmbEr Eventid & "|" & cmbErRaceid
end sub
this is the form which should have assigned the id into the new table:
Code:
Private Sub Form_Load() If Len(Me.OpenArgs & "") > 0 Then Dim i As Integer Dim s As String Dim x As String Dim y As Integer Dim a As String Dim b As Integer s = CStr(Me.OpenArgs) i = InStr(1, s, "|") x = Left(s, i - 1) y = CInt(x) Me.txtAddRunnerEventid.SetFocus Me.txtAddRunnerEventid.Text = y a = Mid(s, i + 1) b = CInt(a) Me.txtInputRunnerid.SetFocus txtAddRunnerRaceid = b End If End Sub
Comment