Quick Coding Issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Im trying to get the next form opened to match the trialnumber of the current
form.
Im pretty sure i have got some quotes in the wrong place as TrialNum is
integer not string.

Cheers


Private Sub Command15_Click()
On Error GoTo Err_Command15_Click

Dim stDocName As String
Dim stLinkCriteria As Integer
If Me.ProductType = "F Bonded Sheet" Then
stDocName = "FrmNeedlingSpec"
stLinkCriteria = "[TrialNum] = ' " & Me.TrialNum & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click
End Sub
 
I think it should be

stLinkCriteria = "[TrialNum] = " & Me.TrialNum & " "

(take out the single quotes)
 
Craig said:
Im trying to get the next form opened to match the trialnumber of the current
form.
Im pretty sure i have got some quotes in the wrong place as TrialNum is
integer not string.

Cheers


Private Sub Command15_Click()
On Error GoTo Err_Command15_Click

Dim stDocName As String
Dim stLinkCriteria As Integer
If Me.ProductType = "F Bonded Sheet" Then
stDocName = "FrmNeedlingSpec"
stLinkCriteria = "[TrialNum] = ' " & Me.TrialNum & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click
End Sub

If the field is numeric, then there's no need for quotes

stLinkCriteria = "[TrialNum] = " & Me.TrialNum
 
Thanks for the quick response working fine now!

CR


scubadiver said:
I think it should be

stLinkCriteria = "[TrialNum] = " & Me.TrialNum & " "

(take out the single quotes)

--

The 11th day of every month:

http://truthaction.org/forum/index.php


Craig said:
Im trying to get the next form opened to match the trialnumber of the current
form.
Im pretty sure i have got some quotes in the wrong place as TrialNum is
integer not string.

Cheers


Private Sub Command15_Click()
On Error GoTo Err_Command15_Click

Dim stDocName As String
Dim stLinkCriteria As Integer
If Me.ProductType = "F Bonded Sheet" Then
stDocName = "FrmNeedlingSpec"
stLinkCriteria = "[TrialNum] = ' " & Me.TrialNum & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If

Exit_Command15_Click:
Exit Sub

Err_Command15_Click:
MsgBox Err.Description
Resume Exit_Command15_Click
End Sub
 
Back
Top