rushitshah
Registered User.
- Local time
- Today, 13:57
- Joined
- Jul 27, 2005
- Messages
- 19
Hi People,
I am getting error in find duplicate SQL on DoCmd runsql strsql1 statement.
What I am doing is declaring p as an alias for table name, because I am taking table name as input from user from the form. That table is already in the DB. When I do MsgBox "" & p, in place of table name it shows nothing, message box is empty.
It also gives an error the MS Jet database engine is not able to find the query or table, make sure that it exists or spelled correctly. But that table is there in DB.
Is there something wrong in syntax. Where clause is too long, because there are many fields in my table. I am checking for group of 5 fields for the duplicates.
Dim strSQL1 As String
strSQL1 = "SELECT p.* " & _
"INTO [" & Me.Latest & "]" & _
"FROM [" & Me.PCycle & "] p " & _
"WHERE (((p.infr_cls_nm) In (SELECT [infr_cls_nm] FROM p As Tmp GROUP BY [infr_cls_nm],[infr_itm_nm],[parm_nm],[area_subarea_nm],[hrz_extnd_char],[hrz_extnd_itm_char],[hrz_extnd_itm_char1],[hrz_extnd_itm_char2] HAVING Count(*)>1 And [infr_itm_nm] = p.[infr_itm_nm] And [parm_nm] = p.[parm_nm] And [area_subarea_nm] = p.[area_subarea_nm] And [hrz_extnd_char] = p.[hrz_extnd_char] And [hrz_extnd_itm_char] = p.[hrz_extnd_itm_char] And [hrz_extnd_itm_char1] = p.[hrz_extnd_itm_char1] And [hrz_extnd_itm_char2] = p.[hrz_extnd_itm_char2])))" & _
"ORDER BY p.infr_cls_nm, p.infr_itm_nm, p.parm_nm, p.area_subarea_nm, p.hrz_extnd_char, p.hrz_extnd_itm_char, p.hrz_extnd_itm_char1, p.hrz_extnd_itm_char2;"
MsgBox "" & p
Debug.Print strSQL1
DoCmd.RunSQL strSQL1
I am getting error in find duplicate SQL on DoCmd runsql strsql1 statement.
What I am doing is declaring p as an alias for table name, because I am taking table name as input from user from the form. That table is already in the DB. When I do MsgBox "" & p, in place of table name it shows nothing, message box is empty.
It also gives an error the MS Jet database engine is not able to find the query or table, make sure that it exists or spelled correctly. But that table is there in DB.
Is there something wrong in syntax. Where clause is too long, because there are many fields in my table. I am checking for group of 5 fields for the duplicates.
Dim strSQL1 As String
strSQL1 = "SELECT p.* " & _
"INTO [" & Me.Latest & "]" & _
"FROM [" & Me.PCycle & "] p " & _
"WHERE (((p.infr_cls_nm) In (SELECT [infr_cls_nm] FROM p As Tmp GROUP BY [infr_cls_nm],[infr_itm_nm],[parm_nm],[area_subarea_nm],[hrz_extnd_char],[hrz_extnd_itm_char],[hrz_extnd_itm_char1],[hrz_extnd_itm_char2] HAVING Count(*)>1 And [infr_itm_nm] = p.[infr_itm_nm] And [parm_nm] = p.[parm_nm] And [area_subarea_nm] = p.[area_subarea_nm] And [hrz_extnd_char] = p.[hrz_extnd_char] And [hrz_extnd_itm_char] = p.[hrz_extnd_itm_char] And [hrz_extnd_itm_char1] = p.[hrz_extnd_itm_char1] And [hrz_extnd_itm_char2] = p.[hrz_extnd_itm_char2])))" & _
"ORDER BY p.infr_cls_nm, p.infr_itm_nm, p.parm_nm, p.area_subarea_nm, p.hrz_extnd_char, p.hrz_extnd_itm_char, p.hrz_extnd_itm_char1, p.hrz_extnd_itm_char2;"
MsgBox "" & p
Debug.Print strSQL1
DoCmd.RunSQL strSQL1