Cant Edit the data (1 Viewer)

bitzgam

Registered User.
Local time
Today, 07:46
Joined
Dec 5, 2014
Messages
21
Hello guys, I need some help. I have a form(frmAddApplicant) based on a query(qryAddApplicant) and that qry is based on two tables "tblApplicant" and "tblGovernmentRef".

In the form I got a tab control(see attachment)
when I add a new record, let say all the general information.and I forgot to add the GovernmentRef(which is in the second Tab) or let say the Applicant has no GovernmentRef yet.

*My PROBLEM is. I cant edit that certain applicant his GovernmentRef.

If a new record Added and let say all the General information as well as the GovernmentRef of that applicant has added a value then there so no problem edeting there all value as well as the GovernmentRef :banghead:

is there any problem with my query? or did I miss something? please help :eek:

GodBless
 

Attachments

  • regestration.jpg
    regestration.jpg
    73.6 KB · Views: 94

burrina

Registered User.
Local time
Yesterday, 18:46
Joined
May 10, 2014
Messages
972
What do you mean you can't edit/add? What happens? Any error? Are the 2 forms linked?
 

ConnorGiles

Strange Traveller
Local time
Today, 00:46
Joined
Aug 12, 2014
Messages
1,068
Second of all, You need to post rather a SQL of your query or show us what your query is like for us to even have an idea of what the problem is with your query.
 

bitzgam

Registered User.
Local time
Today, 07:46
Joined
Dec 5, 2014
Messages
21
What do you mean you can't edit/add? What happens? Any error? Are the 2 forms linked?

Hello Sir, thank you for the response. in this particular problem i only have 1 form sir which is based on a qryAddApplicant

My only problem is I cant Edit any Applicants GovernmentRef in a query if that applicant has no information in it.
 

bitzgam

Registered User.
Local time
Today, 07:46
Joined
Dec 5, 2014
Messages
21
Second of all, You need to post rather a SQL of your query or show us what your query is like for us to even have an idea of what the problem is with your query.


Sir thank you for the response. I have a query (qryAddApplicant) and that query is based on two tables "tblApplicant" and "tblGovernmentRef".

Let say on the query is has Firstname and LastName field from tblApplicant and VotersID field on tblGovernmentRef.

My problem is I cant edit the information of a certain applicant if in his VotersID field is no data. Hope you can understand my explanation.
Thank YOu
God Bless
 

ConnorGiles

Strange Traveller
Local time
Today, 00:46
Joined
Aug 12, 2014
Messages
1,068
Just going to take a quick shot here before asking more questions -

VotersID should preferably be an AutoNumber - So there should never be an absense of data. that may solve your problem.

If that isn't the problem please show a screenshot of your query or a sample database or with your query inside.
 

bitzgam

Registered User.
Local time
Today, 07:46
Joined
Dec 5, 2014
Messages
21
Just going to take a quick shot here before asking more questions -

VotersID should preferably be an AutoNumber - So there should never be an absense of data. that may solve your problem.

If that isn't the problem please show a screenshot of your query or a sample database or with your query inside.

see attached files Sir
Try edit information on Applicant1 and Applicant2 in there Voters-ID
Thank you once again
 

Attachments

  • samp.accdb
    576 KB · Views: 79

Never Hide

Registered User.
Local time
Today, 02:46
Joined
Dec 22, 2011
Messages
96
I check your database, you had a wrong type of relationship between the two tables. Also GovernmentRef_ID in tblApplicant is a foreign key referencing the ID of tblGovernmentRef. You can't set a default value to a foreign key because if that number doesn't exist in the referenced table you get an error. So when you left that empty in your form, the new entry in the tblApplicant would put, in your case 0, in the GovernmentRef_ID and since that values doesn't exist you get an error. I corrected that and the relationship in the attachement.
 

Attachments

  • samp.accdb
    640 KB · Views: 74

bitzgam

Registered User.
Local time
Today, 07:46
Joined
Dec 5, 2014
Messages
21
I check your database, you had a wrong type of relationship between the two tables. Also GovernmentRef_ID in tblApplicant is a foreign key referencing the ID of tblGovernmentRef. You can't set a default value to a foreign key because if that number doesn't exist in the referenced table you get an error. So when you left that empty in your form, the new entry in the tblApplicant would put, in your case 0, in the GovernmentRef_ID and since that values doesn't exist you get an error. I corrected that and the relationship in the attachement.


thank you very much Sir, now I know whats the purpose of Enforce Referential Integrity :) :D
 

Users who are viewing this thread

Top Bottom