| Forum Home | ||||
| Press F1 | ||||
| Thread ID: 18272 | 2002-04-21 23:15:00 | MS Access Combobox help Please. | Guest (0) | Press F1 |
| Post ID | Timestamp | Content | User | ||
| 44980 | 2002-04-21 23:15:00 | I have looked at various similar questioms on the web but have not yet been able to find a solution. I Have an unbound combo box on my form which takes an ID number from a separate table and when selected 3 text boxes on the current form are autofilled which relate to that unique number. I am using the folowing Dlookup code which I can't get to work. Can anyone help? Private Sub Combo234_AfterUpdate() 'Update Freight Company controls based on value selected in Freight_ID combo box Dim varFreightCompany, varPhone, varWebSite As Variant varFreightCompany = DLookup('[FreightCompany]', 'tblFreightCompany', '[FreightCompany] = ' & FreightCompany) varPhone = DLookup('[Phone]', 'tblFreightCompany', '[Phone] = ' & Phone) varWebSite = DLookup('[WebSite]', 'tblFreightCompany', '[WebSite] = ' & WebSite) If (Not IsNull(varFreightCompany)) Then Me![FreightCompany] = varFreightCompany If (Not IsNull(varPhone)) Then Me![Phone] = varPhone If (Not IsNull(varWebSite)) Then Me![WebSite] = varWebSite End Sub |
Guest (0) | ||
| 44981 | 2002-04-23 02:16:00 | Hi Bill I haven't done Access work for a while but I think if your combo is unbound you won't get before/after update events. Try putting the code in the 'click' event handler instead (the 'change' event won't fire either if the only change is to choose another item in the list, you actually have to edit the text) Cheers Mike |
Guest (0) | ||
| 44982 | 2002-04-23 06:41:00 | Thanks, Will Give it ago. |
Guest (0) | ||
| 1 | |||||