My Assistant
![]() ![]() |
|
|
Oct 2 2006, 05:04 PM
Post
#1
|
|
|
UtterAccess Enthusiast Posts: 60 |
I have a combo box with the following code attached to the change event...
CODE Private Sub cmbHardware_Change() If Not IsNull(cmbHardware.Value) Then currentHardware = cmbHardware.Value currentHardwareDesc = cmbHardware.Text SelectFields End If End Sub The function "SelectFields" is giving me the following error... can't move the focus to the control when I type something into the combo box in order to find an entry that begins with that letter (I get the error when there are no entries that match what I've typed). Here is the code in "SelectFields" where it fails (line that fails is in red)... CODE Public Sub SelectFields()
Dim rst As Recordset Dim whereClause As String whereClause = " WHERE pkHardware = " & cmbHardware.Value ' Employees (if Hardware mode) Set rst = CurrentDb.OpenRecordset("select EMPLOYEEID, EmployeeName from Employees INNER JOIN Hardware ON Hardware.fkEmployee = Employees.EMPLOYEEID" & whereClause) [color="red"]cmbEmployee.SetFocus[/color] If Not rst.EOF Then cmbEmployee.SelText = rst.Fields(1).Value Else cmbEmployee.SelText = "" End If Set rst = Nothing First of all, I don't want the onchange event to fire when something isn't actually selected. Secondly, why can't it give focus to the control? Yes, the control is visible and enabled. |
|
|
|
Oct 2 2006, 05:07 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 3,656 From: Yorkshire, England. |
Try moving the event to AfterUpdate for the combo box, does that help?
Ad |
|
|
|
Oct 2 2006, 05:15 PM
Post
#3
|
|
|
UtterAccess Enthusiast Posts: 60 |
I have a different error now...
The macro or function set to the BeforeUpdate or ValidationRule property for this field is preventing "Inventory Management" from saving the data in this field. I don't have any macros or functions tied to either of those properties as far as I know. |
|
|
|
Oct 2 2006, 05:30 PM
Post
#4
|
|
|
UtterAccess Enthusiast Posts: 60 |
I have implemented a less than ideal solution to the problem...
In "SelectFields" I put... On Error GoTo Skip: And I skip the whole function. The behavior works beautifully for the end-user now except now I won't know when I have a valid error. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 20th May 2013 - 02:16 AM |