I'm trying to set the default value of a few items on my form so I don't have to keep updating them as I scan items to a table. I have 3 comboboxes in my form and the other two are working fine (keeping the same value after record entry) but the cbx for "Equipment" is consistently giving me this error. I've tried updating field names by going from "Type" to "Equipment Type" and now to "Equipment" and that has not fixed it. I'll try to give good context below, but please let me know if there is more information you need. Thanks! --Forgot to mention that the table for equipment types has one field: "EQType" and it is set as the primary key.
VBA to set default values in comboboxes
Private Sub Serial_Number_AfterUpdate()
[Equipment].DefaultValue = [Equipment]
[ToTech].DefaultValue = [ToTech]
[FromTech].DefaultValue = [FromTech]
End Sub
Field names of the table I'm updating:
Information about form:
Split form, named "Transfers", Record Source = Transfers table
DefaultValue
is text, so you probably miss to quote the value:
Private Sub Serial_Number_AfterUpdate()
Me![Equipment].DefaultValue = "'" & Me![Equipment].Value & "'"
Me![ToTech].DefaultValue = Me![ToTech].Value
Me![FromTech].DefaultValue = Me![FromTech].Value
End Sub