Strange error

mcdhappy80

Registered User.
Local time
Today, 12:17
Joined
Jun 22, 2009
Messages
347
I have a form and since I change it's record source from table to query (with same data as the table and some more) I'm getting this error:

JoinError.jpg


The error occurs when I try to select records from the third of mine three combo boxes I have on that form, and only when I'm on the blank (new) record.

On the second picture I'm giving You the database relations and I'll explain what is bound to what:

RacunovodstvoRelations.jpg


The main form was bound to table tblZahtev and now to qryZahtev which has all the records from tblZahtev plus related records from tables tblTipDokumentacije, tblPorodica and tblDete.
I've created the combo boxes by first creating lookup fields when I created tables and then when I created form from table the comboboxes were there.
The first combo box is bound to field tblZahtev.intDocTipID and its record source are two fields intTipDocID (PK), and txtTipDocNaziv from tblTipDokumentacije. This combobox works fine.
The second combo box is bound to tblZahtev.txtSifraDetetaID and its record source are tblDete.txtSifraDetetaID (PK) and Dete:[tblDete].[txtIme] & " " & [tblDete].[txtPrezime] (combined field). This combo box works as it should.
The third (the problematic one) is bound to tblZahtev.intPorodicaID and its record source are tblPorodica.intPorodicaID, and Potpisnik:[tblPorodica].[txtImePotp] & " " [tblPorodica].[txtPrezPotp] (a combined field).

When I'm on the existing record in tblZahtev and I try to change the value of tblZahtev.intPorodicaID via the combo box that works, but as soon as I switch to enter new record in tblZahtev, and try to select record from combo box Porodica I'm getting that error.

If I understand the error correctly I'm trying to select a record in the combo box which doesn't exist in tblPorodica but how can that be if the only records for selection in the combo box are those from the tblPorodica.

I really don't understand what is happening here. Every help is welcome.

Thank You.
 
Send a short example of this MDB. (Access 2000 or 2002).
 
Send a short example of this MDB. (Access 2000 or 2002).
What do You mean by short example (just tables. qryZahtev, and frmZahtev)?
My database is .accdb, which format should I send?
While I'm waiting for this answer here's a SQL code for qryZahtev for You to analyze:
Code:
SELECT tblZahtev.intZahtevID, tblZahtev.dteDatumZahteva, tblZahtev.txtBrUgovora, tblZahtev.bolDoc1, tblZahtev.bolDoc2, tblZahtev.bolDoc3, tblZahtev.bolDoc4, tblZahtev.intDocTipID, tblTipDokumentacije.intTipDocID, tblTipDokumentacije.txtTipDocNaziv, tblZahtev.txtSifraDetetaID, tblDete.txtSifraDetetaID, [tblDete].[txtIme] & " " & [tblDete].[txtPrezime] AS Dete, tblDete.dteDatumRodjenja, tblDete.txtMBDeteta, tblMestaPohadjanja.txtMestoPohID, tblMestaPohadjanja.txtNazivMesta, tblZahtev.intPorodicaID, tblPorodica.intPorodicaID, [tblPorodica].[txtImePotp] & " " & [tblPorodica].[txtPrezPotp] AS Potpisnik, [tblPorodica].[txtImeBDrugPotp] & " " & [tblPorodica].[txtPrezBDrugPotp] AS BDrug, tblPorodica.txtAdresa, tblPorodica.txtBrTel, tblPorodica.txtPreduzeceOca, tblPorodica.txtPreduzeceMajke, tblPorodica.intBrClanova, tblZahtev.dblUkupnoPrimanje, tblZahtev.dblPoClanu, tblZahtev.txtSkala, tblZahtev.dblVrednostSkale, tblZahtev.memNapomena, tblDete.txtSrednjeIme, tblDete.bolDrugoDete, tblDete.bolTreceDete, tblDete.bolCetvrtoDete, tblDete.bolDeteRadnika, tblDete.txtFDZBrUgovora, tblDete.bolSituacija1, tblDete.bolSituacija2, tblDete.bolSituacija3, tblDete.bolKorekcijaSkale, tblDete.dblVrednostKorekcije, tblDete.bolOslobodjenPlacanja, tblPorodica.txtImeBDrugPotp, tblPorodica.txtPrezBDrugPotp, tblPorodica.txtMBOca, tblPorodica.txtMBMajke, tblPorodica.txtPTTBr, tblMesto.txtNazivMesta, tblPorodica.bolNezaposlenRoditelj, tblPorodica.bolVlasnikPreduzeca
FROM tblTipDokumentacije INNER JOIN ((tblMesto INNER JOIN tblPorodica ON tblMesto.txtPTTBr = tblPorodica.txtPTTBr) INNER JOIN (tblMestaPohadjanja INNER JOIN (tblDete INNER JOIN tblZahtev ON tblDete.txtSifraDetetaID = tblZahtev.txtSifraDetetaID) ON tblMestaPohadjanja.txtMestoPohID = tblDete.txtMestoPohID) ON tblPorodica.intPorodicaID = tblZahtev.intPorodicaID) ON tblTipDokumentacije.intTipDocID = tblZahtev.intDocTipID
ORDER BY tblZahtev.intZahtevID;
I've found out that if I remove the control source(s) for the two of mine controls (bolNezaposlenRoditelj, bolVlasnikPreduzeca), and make them unbound, (fields in the query that controls are bound to have same names) everything works as it should.

So can someone analyze this SQL syntax and tell me what's wrong (because I'm not too god with table JOINS), because I susspect the problem is in those JOINS.

Thank You
 

Users who are viewing this thread

Back
Top Bottom