G
George Papadopoulos
Hello everybody
I am trying to create a new query programmatically. Specifically I have
two forms. On the first one there exists a button which when pressed passes
a code as a parameter and then opens a second form. The code is as shown
below :
Private Sub List_spares_Click()
On Error GoTo Err_cmdGoHere_Click
Dim stDocName As String
stDocName = "LISTA_ANTALLAKTIKWN"
DoCmd.OpenForm stDocName, OpenArgs:=Me.[Kwdikos_episkeyhs]
Exit_cmdGoHere_Click:
Exit Sub
Err_cmdGoHere_Click:
MsgBox Err.Description
Resume Exit_cmdGoHere_Click
End Sub
The OnLoad handler for the second form is
Private Sub Form_Load()
Dim dbEPEMBATHS As Database
Dim rsSpares As Recordset
Dim Kwdikos As Long
If Not IsNull(Me.OpenArgs) Then
Kwdikos = Me.OpenArgs
End If
' Set dbLib to the current database
Set dbEPEMBATHS = CurrentDb
' Create a query
strselect = "SELECT * FROM ANTALLAKTIKA WHERE 'Kwdikos_episkeyhs =
Kwdikos'"
Set rsSpares = dbEPEMBATHS.OpenRecordSet(strselect)
End Sub
The code fails at the line 'Set rsSpares =
dbEPEMBATHS.OpenRecordSet(strselect)' with the error 'Type mismatch'. Where
could there me a type mismatch there?
Thanks in advance
George Papadopoulos
I am trying to create a new query programmatically. Specifically I have
two forms. On the first one there exists a button which when pressed passes
a code as a parameter and then opens a second form. The code is as shown
below :
Private Sub List_spares_Click()
On Error GoTo Err_cmdGoHere_Click
Dim stDocName As String
stDocName = "LISTA_ANTALLAKTIKWN"
DoCmd.OpenForm stDocName, OpenArgs:=Me.[Kwdikos_episkeyhs]
Exit_cmdGoHere_Click:
Exit Sub
Err_cmdGoHere_Click:
MsgBox Err.Description
Resume Exit_cmdGoHere_Click
End Sub
The OnLoad handler for the second form is
Private Sub Form_Load()
Dim dbEPEMBATHS As Database
Dim rsSpares As Recordset
Dim Kwdikos As Long
If Not IsNull(Me.OpenArgs) Then
Kwdikos = Me.OpenArgs
End If
' Set dbLib to the current database
Set dbEPEMBATHS = CurrentDb
' Create a query
strselect = "SELECT * FROM ANTALLAKTIKA WHERE 'Kwdikos_episkeyhs =
Kwdikos'"
Set rsSpares = dbEPEMBATHS.OpenRecordSet(strselect)
End Sub
The code fails at the line 'Set rsSpares =
dbEPEMBATHS.OpenRecordSet(strselect)' with the error 'Type mismatch'. Where
could there me a type mismatch there?
Thanks in advance
George Papadopoulos