从外部ODBC链接表错误3078“无法在MS Access中找到表”

时间:2014-02-20 22:53:11

标签: sql-server-2008 vba access-vba

在我的Access 2010表单中,我可以添加记录,但在添加记录之前,我们需要能够在写入新记录之前检查SQL表中是否已存在业务单位,年份和季度

我需要确认的三件事是我的表单中的字段,在其各自字段中的SQL表“tTbl_ADMIN_RxREBATE”中称为[BU_Selected_Add],[Qtr_Add]和[Year_Add]: [GL_BU],[年份]和[季度]。 所以我从下面的一个简单的Business_Unit dlookup开始:

 If DLookup("[GL_BU]", "tTbl_ADMIN_RxREBATE", "[GL_BU] = '" & 
 Me!BU_Selected_Add & "'") > 0 Then
 MsgBox "This Business Unit already exists within the data below!"

我收到以下错误:

Run-time error '3078': The Microsoft Access database engine cannot find the 
input table or query "tTbl_ADMIN_RxRebate".  Make sure it exists and that its 
name is spelled correctly.

它肯定存在于SQL Server 2008 R2中。

我需要先添加第一部分,然后再添加[BU_Selected_Add]是否在名为[Qtr_Add]和[Year_Add]的字段框中的年份和季度添加。

  SELECT dbo_tTbl_ADMIN_RxREBATE.MSID, dbo_tTbl_ADMIN_RxREBATE.DateAdded,      dbo_tTbl_ADMIN_RxREBATE.Qtr, dbo_tTbl_ADMIN_RxREBATE.Year, dbo_tTbl_ADMIN_RxREBATE.Rpt_Date, dbo_tTbl_ADMIN_RxREBATE.SRVC_TYP_CD, dbo_tTbl_ADMIN_RxREBATE.GL_BU, dbo_BU_Description.[BU Description], dbo_tTbl_ADMIN_RxREBATE.PY_FNL_PICK_AMT, dbo_tTbl_ADMIN_RxREBATE.PY_FNL_MRGN_AMT, dbo_tTbl_ADMIN_RxREBATE.PY_IBNR_AMT, dbo_tTbl_ADMIN_RxREBATE.CY_FNL_PICK_AMT, dbo_tTbl_ADMIN_RxREBATE.CY_FNL_MRGN_AMT, dbo_tTbl_ADMIN_RxREBATE.CY_IBNR_AMT
  FROM dbo_tTbl_ADMIN_RxREBATE INNER JOIN dbo_BU_Description ON       dbo_tTbl_ADMIN_RxREBATE.GL_BU = dbo_BU_Description.BU
  WHERE (((dbo_tTbl_ADMIN_RxREBATE.Qtr)=[Forms]![Frm_Main]![Frm_Main_Combo_Qtr]) AND ((dbo_tTbl_ADMIN_RxREBATE.Year)=[Forms]![Frm_Main]![Frm_Main_Combo_Year]));

0 个答案:

没有答案