【发布时间】:2021-02-24 07:31:01
【问题描述】:
我正在从我的主表单打开一个子表单以允许更改数据。进行更改后,我想将数据传递回主窗体。删除过滤器,然后返回原始记录。我在子表单中有主键,所以我将其传回。我使用了其他用户的一些代码,但它不起作用不是我的代码。有什么想法吗?
Private Sub cmd_close_Click()
Dim result As String
Dim ID As Variant
result = MsgBox("Save Geo Location?", vbOKCancel, "Save Geo Location")
If result = vbOK Then
Forms!frm_acct_select!GeoLoc_X = Me.txt_GeoLocX
Forms!frm_acct_select!GeoLoc_Y = Me.txt_GeoLocY
Forms!frm_acct_select.FilterOn = False
'this code fails immediately
With frm_acct_select.Form
ID = Me.txt_ParentID.Value
.FilterOn = False
.Recordset.FindFirst "ParentAccountID=" & ID
End With
'this code fails type mismatch criteria at the recordset.findfirst line
' With Forms!frm_acct_select
' ID = Me.txt_ParentID.Value
' .FilterOn = False
' .Recordset.FindFirst "ParentAccountID = " & ID
' End With
DoCmd.Close acForm, "sfrm_geoloc_update", acSaveNo
Else
DoCmd.Close acForm, "sfrm_acct_select_search", acSaveNo
End If
End Sub
【问题讨论】:
-
这与 SQL 语言有什么关系?我看不到 SQL,也看不到表数据。
-
不确定我如何引用 SQL。
-
{56D0791E-0B1B-4955-818A-97CBA4291B32} 是 ID 的值。我尝试在原始代码中指定 Variant 并声明 String。两种变体都失败了。