Hi,
I have a specific question and a general question.
The specific question is this:
I currently have a form with two comboboxes called "Combo Case Code" and "Combo Case Name." I've linked the values to a query that retrieves values for fields called "Case Code" and "Case Name" in a table called "tbl Case Codes and Names".
I'm trying to write an after_update sub procedure that updates the Case Name Combobox with the corresponding Case Code provided in the Case Code Combo box. The code I have is the following:
I get the "Invalid Procedure Call or Argument" error message. How can I make this lookup work?
I suspect the error comes from sloppy name formatting in my code above, which leads me to my general question. How does Access treat names with spaces in general? I know that objects on forms with names that have spaces, such as "my textbox" get renamed "my_textbox" in the VBA environment for event procedures. What about tables, forms, table fields and other objects in Access?
Thank you for your help.
I have a specific question and a general question.
The specific question is this:
I currently have a form with two comboboxes called "Combo Case Code" and "Combo Case Name." I've linked the values to a query that retrieves values for fields called "Case Code" and "Case Name" in a table called "tbl Case Codes and Names".
I'm trying to write an after_update sub procedure that updates the Case Name Combobox with the corresponding Case Code provided in the Case Code Combo box. The code I have is the following:
Code:
Private Sub Combo_Case_Code_AfterUpdate()
Combo_Case_Name = DLookup("[Case Name]", "tbl Case Codes and Names", "[Case Code]=' " & Combo_Case_Code & " ' ")
End Sub
I suspect the error comes from sloppy name formatting in my code above, which leads me to my general question. How does Access treat names with spaces in general? I know that objects on forms with names that have spaces, such as "my textbox" get renamed "my_textbox" in the VBA environment for event procedures. What about tables, forms, table fields and other objects in Access?
Thank you for your help.