Quick Coding Issue

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
 
G

Guest

I think it should be

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

(take out the single quotes)
 
R

RoyVidar

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
 
G

Guest

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
 

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

Similar Threads

Help please 1
search command 2
Code Only works first time! 2
Report To Snapshot 4
Open form 1
popup issue if no existing record 1
transfer a field using button 1
Trying to get Current User info only 2

Top