简体   繁体   English

通过在列表下拉组合框中选择它来访问 VBA 代码到 go 到另一个表单上的特定记录

[英]Access VBA code to go to a specific record on another form via selecting it in a list drop down combo box

I have a form with a combo box with a list of jobs located on a different form all with their own unique record.我有一个带有组合框的表单,其中包含位于不同表单上的工作列表,所有工作都有自己独特的记录。 I would like to be able to click the drop-down of the combo box, select a specific job and then have it open the specific job record I select... Struggling with coming up a VBA code that will do this.我希望能够单击组合框的下拉菜单,select 一个特定的工作,然后让它打开特定的工作记录我 select...努力想出一个 Z6E3EC7E6A9F6007B48398FC0EE 代码就可以了。 Can anyone help?任何人都可以帮忙吗? Thanks谢谢

If you want to open another form that just shows the record selected in a combo box, then you can use the control's AfterUpdate event, and use the "Where condition" argument of the OpenForm action:如果要打开另一个仅显示组合框中所选记录的表单,则可以使用控件的AfterUpdate事件,并使用OpenForm操作的“Where 条件”参数:

Private Sub cboSearch_AfterUpdate()
    On Error GoTo E_Handle
    DoCmd.OpenForm "frmData", , , "FileID=" & Me!cboSearch
sExit:
    On Error Resume Next
    Exit Sub
E_Handle:
    MsgBox Err.Description & vbCrLf & vbCrLf & "frmSearch!cboSearch_AfterUpdate", vbOKOnly + vbCritical, "Error: " & Err.Number
    Resume sExit
End Sub

Regards,问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Access VBA能否分辨出键入组合框和从下拉列表中进行选择之间的区别? - Can Access VBA tell the difference between typing into a combo box and selecting from a drop down? 如何确定在组合框中键入内容和从 Access VBA 中的下拉列表中进行选择之间的区别? - How can I determine the difference between typing into a combo box and selecting from a drop down in Access VBA? 下拉列表组合框excel - drop down list combo box excel 访问 vba 使用组合框重新打开记录 - access vba Reopen a record using combo box 是否可以在访问表格的下拉框中使用2个不同的记录源? - IS it possible to use 2 different record sources for a drop down box on an access form? MS Access 从子表单的组合框中选择下拉菜单后,在主表单中填写 ID - MS Access Fill in ID in the Main Form after select drop down from combo box in Subform VBA代码以选择组合框(访问) - VBA code to make a combo box selection (Access) MS Access数据库中的MS Word下拉列表或组合框 - MS Word Drop down list or combo box from MS Access Database MS Access:将值从表单文本框传递到新记录上的另一个表单组合框? - MS Access: Pass Value from Form Textbox to Another Form Combo Box on a New Record? 访问用于在列表框中上下滚动所选项目的 vba 代码 - Access vba code for scroll up and down selected item in the list box
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM