Guest_imported
New member
- Jan 1, 1970
- 0
Good day,
I am using MS Access 2003 (VBA) running on MS Windows XP.
I created a drop-down combo box using the wizard in a sub form. The associated table has one field [FileLocation] and a primary key. The drop down list contains partial path names for document locations. I have the following code in the AfterUpdate() event procedure.
Private Sub Combo4_AfterUpdate()
Select Case Combo4
Case 1
Me.Combo4 = "C:/pickapath/"
Case 2
Me.Combo4 = "D:/otherpaths/"
End Select
'populate MainForm control
Forms!FrmMain!txtLocation = Me.Combo4
End Sub
I have two issues I can't seem to resolve. The first is that whenever a selection is made, it results in an error message that reads: The value you entered isn't valid for this field". The field is text with 100 size. The partial path name is successfully placed in the control when I select the OK button on the error message. It is also passed correctly to MainForm. How can i get rid of the error message?
second issue: How can I make it so the user can add to the list? I saw the AddItem in the help files but isn't there a way to automate this for the users? I was hoping that if a user types a partial path name that is not in the list, a message box could come up and ask if they wanted to add it. then when they click Yes, it would automatically be added to the list. I searched the Tek-tips for this issue but could not find it.
I am new to Access and VBA so detail and examples are much appreciated. Thank you. I appreciate your help and time.
55
I am using MS Access 2003 (VBA) running on MS Windows XP.
I created a drop-down combo box using the wizard in a sub form. The associated table has one field [FileLocation] and a primary key. The drop down list contains partial path names for document locations. I have the following code in the AfterUpdate() event procedure.
Private Sub Combo4_AfterUpdate()
Select Case Combo4
Case 1
Me.Combo4 = "C:/pickapath/"
Case 2
Me.Combo4 = "D:/otherpaths/"
End Select
'populate MainForm control
Forms!FrmMain!txtLocation = Me.Combo4
End Sub
I have two issues I can't seem to resolve. The first is that whenever a selection is made, it results in an error message that reads: The value you entered isn't valid for this field". The field is text with 100 size. The partial path name is successfully placed in the control when I select the OK button on the error message. It is also passed correctly to MainForm. How can i get rid of the error message?
second issue: How can I make it so the user can add to the list? I saw the AddItem in the help files but isn't there a way to automate this for the users? I was hoping that if a user types a partial path name that is not in the list, a message box could come up and ask if they wanted to add it. then when they click Yes, it would automatically be added to the list. I searched the Tek-tips for this issue but could not find it.
I am new to Access and VBA so detail and examples are much appreciated. Thank you. I appreciate your help and time.
55