Forum Discussion
Form Combo Box Doesn’t Store Selected Value (Foreign Key Issue)
Hi all, I'm building a data entry form for the Peserta_Workshop table in Microsoft Access. This table includes a field called ID_Unit_Kerja, which is a foreign key referencing the Unit_Kerja table. In the form, I'm using a Combo Box to select a unit from Unit_Kerja, and I've set the Row Source to SELECT ID_Unit_Kerja, Nama_Unit_Kerja FROM Unit_Kerja. The Control Source is already set to ID_Unit_Kerja. However, when I select a unit from the combo box, the value does not get saved to the Peserta_Workshop table, and sometimes an SQL or NULL error appears. I’ve set Bound Column to 1 and Column Widths to 0cm;5cm. What could be the issue? Appreciate your help!
3 Replies
- MendipDataSystemsBrass Contributor
From your screenshot your table is provably called Unit Kerja Peserta so your SQL is invalid though I would have expected a different error message.
Two other points:
1. Table level lookup fields are not recommended.
2. Similarly avoid using spaces in object names. Either use underscores or just e.g. UnitKerjaPeserta - Tom_van_StiphoutIron Contributor
I've seen this happen in early versions of the Monaco editor to edit queries. Try turning it off and re-saving all queries: file > options > current database > enable monaco sql editor.
- arnel_gpIron Contributor
upload your db for analysis.