Sql for a combo using text control from parent form

ricardofbarreiro

Registered User.
Local time
Today, 12:17
Joined
Jun 19, 2014
Messages
17
Private Sub cboConsulta_GotFocus()
Dim strsql As String
strsql = "SELECT ID_Verificação,Verificação FROM tblVerificacao WHERE ID_Peça = '" & Parent!TxTId_Peça & "' ORDER BY Verificação;"
Me!CboConsulta.RowSource = strsql
End Sub

Message Box: Data type mismatch in criteria with data

field ID_Peça = number

TxtID_Peça = receives from field = number

What Am I doing wrong?
 
If these fields are number, yoou do not need the single quotes here

Code:
....WHERE ID_Peça = [COLOR=red]'[/COLOR]" & Parent!TxTId_Peça & "[COLOR=red]' [/COLOR]....
 

Users who are viewing this thread

Back
Top Bottom