F
Fred Boer
Hello:
Well, I've had a problem that had me screaming silently at the walls over
the last day or so. I know how it is caused; I can reproduce the problem. I
don't know *why* it happens. I think this is a case of "Doctor, it hurts
when I put my arm this way". with the expected response, but I'd be curious
if someone could explain the *why* of this problem.
Warning: This is fairly involved, and involves what will be quickly obvious
is a rather bizarre way of creating a form with a combobox to do a lookup to
a lookup table. I'm not even sure *why* I did things this way. (I'm not
likely to do it again!) However, what interests me is that *if* you did
this, you end up with something that *looks* completely correct, but still
causes an unexpected error.
Ok, take a deep breath! <g>
It has to do with the use of the wizard in creating forms.
Imagine the following:
tblName (NameID;Name;CityID - lookup to tblCity)
tblCity (CityID;City)
Create a form using wizard. Include tblName.NameID; tblName.Name. Then,
manually add a combobox to perform the lookup to tblCity, bound to
tblName.CityID. Create a new record, leaving the combobox empty. Access
saves record without protest.
Now, if you do it this way (I *know* this is a bit odd.):
Create a form using the wizard. Include tblName.NameID;tblName.Name;
tblCity.City.
The new form will have a textbox bound to tblCity.City. Change this to a
combobox. Change all of the appropriate properties so that the combobox does
a correct lookup to tblCity.CityID, and is bound correctly to
tblName.CityID. Adjust the recordsource of the form so that it contains only
the appropriate fields.
Now, even though everything *looks* perfectly correct - Access will not let
you save a record with the combobox empty. It throws the following error
message:
The Microsoft Jet database engine cannot find a record in the table
'tblCity' with key matching field(s) 'PlaceID'.
Ok, ok, it is a completely wonky way to create a form. But if I did it,
someone else might - and it isn't easy to see what the problem is. I
*imagine* that Access has created hidden relationships that prevent the
record from being saved. But I don't know..
Cheers!
Fred Boer
Well, I've had a problem that had me screaming silently at the walls over
the last day or so. I know how it is caused; I can reproduce the problem. I
don't know *why* it happens. I think this is a case of "Doctor, it hurts
when I put my arm this way". with the expected response, but I'd be curious
if someone could explain the *why* of this problem.
Warning: This is fairly involved, and involves what will be quickly obvious
is a rather bizarre way of creating a form with a combobox to do a lookup to
a lookup table. I'm not even sure *why* I did things this way. (I'm not
likely to do it again!) However, what interests me is that *if* you did
this, you end up with something that *looks* completely correct, but still
causes an unexpected error.
Ok, take a deep breath! <g>
It has to do with the use of the wizard in creating forms.
Imagine the following:
tblName (NameID;Name;CityID - lookup to tblCity)
tblCity (CityID;City)
Create a form using wizard. Include tblName.NameID; tblName.Name. Then,
manually add a combobox to perform the lookup to tblCity, bound to
tblName.CityID. Create a new record, leaving the combobox empty. Access
saves record without protest.
Now, if you do it this way (I *know* this is a bit odd.):
Create a form using the wizard. Include tblName.NameID;tblName.Name;
tblCity.City.
The new form will have a textbox bound to tblCity.City. Change this to a
combobox. Change all of the appropriate properties so that the combobox does
a correct lookup to tblCity.CityID, and is bound correctly to
tblName.CityID. Adjust the recordsource of the form so that it contains only
the appropriate fields.
Now, even though everything *looks* perfectly correct - Access will not let
you save a record with the combobox empty. It throws the following error
message:
The Microsoft Jet database engine cannot find a record in the table
'tblCity' with key matching field(s) 'PlaceID'.
Ok, ok, it is a completely wonky way to create a form. But if I did it,
someone else might - and it isn't easy to see what the problem is. I
*imagine* that Access has created hidden relationships that prevent the
record from being saved. But I don't know..
Cheers!
Fred Boer