最新消息(周一晚上)
首先,我成功地显示并从我的city_table中选择,填充 表格上的city_no
然后我尝试使用该值来提取/使用city_nm和 state_nm在同一表格上。
我将此编码为city_no的(修改的)更新后代码。
Private Sub city_no_AfterUpdate()
Dim got_city_nm, got_state_nm
got_city_nm = DLookup("[city_nm]", "city_table", "[city_no]" = "city_no")
got_city_nm = DLookup("city_nm", "city_table", "city_no='" & Me.city_no & "'")
city_nm = got_city_nm
got_state_nm = DLookup("[state_nm]", "city_table", "[city_no]" = "city_no")
got_state_nm = DLookup("state_nm", "city_table", "city_no='" & Me.city_no & "'")
state_nm = got_state_nm
seat_no = "XXX"
End Sub
仍然没有任何事情发生,包括最后一句话(将“XXX”分配给seat_no)
所以我把它简化为自己尝试:
Private Sub city_no_AfterUpdate()
seat_no = "XXX"
End Sub
仍然没有。我显然遗漏了一些简单而微不足道的东西。
答案 0 :(得分:0)
将“城市名称”文本框的RecordSource
属性设置为:
=DLookup("[city_nm]", "city_table", "[city_no]" = "city_no")
。
然后将State Name文本框的RecordSource
属性设置为:
=DLookup("[state_nm]", "city_table", "[city_no]" = "city_no")