G
Guest
Hello,
I am trying to concatenate a Text Variable and a Long Integer. Is there any
way to make this happen and not get a 'Type Mismatch' error? I am trying to
have 'page_num' (which is defined as 'Text' in the underlying table), show
the hard-coded Page # + the 'cyclenum' (which is defined as a Long Integer in
the underlying table). I have tried putting quotes around the hard-coded
Page #, but I can't capture 'cyclenum'. As you can see, I also tried to 'Dim
cyclenum As String' (now commented out), but that didn't work either. the
'page_num' field MUST be Text, as some of them include characters and
numbers. Is there a way to do this? Thank you, the code is below.
Private Sub cyclenum_AfterUpdate()
'Dim cyclenum As String
If cyclenum = 0 Then
FrameStudyPhase = 1
'Me.preg_test.Enabled = True
Me.page_num = 16 + "-" + cyclenum
ElseIf cyclenum = 99 Then
FrameStudyPhase = 3
'Me.preg_test.Enabled = False
Me.page_num = 38 + "-" + cyclenum
ElseIf cyclenum = 88 Then
FrameStudyPhase = 4
'Me.preg_test.Enabled = False
Me.page_num = 46 + "-" + cyclenum
Else: FrameStudyPhase = 2
'Me.preg_test.Enabled = False
Me.page_num = 27 + "-" + cyclenum
End If
End Sub
I am trying to concatenate a Text Variable and a Long Integer. Is there any
way to make this happen and not get a 'Type Mismatch' error? I am trying to
have 'page_num' (which is defined as 'Text' in the underlying table), show
the hard-coded Page # + the 'cyclenum' (which is defined as a Long Integer in
the underlying table). I have tried putting quotes around the hard-coded
Page #, but I can't capture 'cyclenum'. As you can see, I also tried to 'Dim
cyclenum As String' (now commented out), but that didn't work either. the
'page_num' field MUST be Text, as some of them include characters and
numbers. Is there a way to do this? Thank you, the code is below.
Private Sub cyclenum_AfterUpdate()
'Dim cyclenum As String
If cyclenum = 0 Then
FrameStudyPhase = 1
'Me.preg_test.Enabled = True
Me.page_num = 16 + "-" + cyclenum
ElseIf cyclenum = 99 Then
FrameStudyPhase = 3
'Me.preg_test.Enabled = False
Me.page_num = 38 + "-" + cyclenum
ElseIf cyclenum = 88 Then
FrameStudyPhase = 4
'Me.preg_test.Enabled = False
Me.page_num = 46 + "-" + cyclenum
Else: FrameStudyPhase = 2
'Me.preg_test.Enabled = False
Me.page_num = 27 + "-" + cyclenum
End If
End Sub