Says primarykey is NULL when infact isnt

spn200286

Registered User.
Local time
Today, 23:21
Joined
Feb 7, 2005
Messages
56
hey again, i usually don't post this much and prefer to work it out alone but i have no idea why this isnt working (and the error im getting)

below are screen shots, i am trying to make an improved booking system, but i don't know why its saying i have a null value (i went through and made sure all fields are filled, in all related tables just to make sure)

QueryPrimarykey.jpg

QueryPrimarykeydesign.jpg


Is your BookingID set to autonumber? If it is an autonumber, where does the B come from?

no i have them all set as text with a inputmask of B000 (so booking numbers have to start with a letter (b) followed by three numbers)


(i edited and made new post as had a vague, uninteresting title)
 

Attachments

Last edited:
I think the problem lies in the next record showing on your query. Do you want this query to Allow Additions?
 
I think the problem lies in the next record showing on your query. Do you want this query to Allow Additions?

i wasn't that clear to the purpose was i

i want this to be a sub form, which is embedded in a function(or customer) form, it will let a new booking be made and work out the price (i have not added that section of it yet)

does that make any sense? (or answer your question)
 
Then somehow, the next BookingID needs to be populated, currently it is empty (ie null) hence the error
 
Then somehow, the next BookingID needs to be populated, currently it is empty (ie null) hence the error

umm, thanks, see i really dont want autonumber as its not really what i need

the error happens though if i try to move form the first row down, making me think it was an error in that row
 
umm, thanks, see i really dont want autonumber as its not really what i need

the error happens though if i try to move form the first row down, making me think it was an error in that row

I think...I have not used an id that wasn't an autonumber, so I might be on the wrong track, the screen and the error seem to go hand in hand - an empty field and a Null value error message.

Some other members may have a solution
Good luck
 
Firstly can you post your DB so we can see exactly what is going on.

Secondly what happens if/when you have more than 1000 bookings? Won't you get duplicate keys?
 
Firstly can you post your DB so we can see exactly what is going on.

Secondly what happens if/when you have more than 1000 bookings? Won't you get duplicate keys?

OK I have put as an attachment (please do not mock me too much =D)

also meetings with client etc said it wont be a while until exceeds 999 records, i will probably change that value before long, once i get a working prototype which performs most of the base actions required


(look at first post i got confused, attachment is there)
 
Last edited:
I don't have A2007 here at work so I will take a look when I get home
 
There are differing views on this, but I always use an autonumber as the PK. If you want a different reference number as well, that's fine, but consider using an autonumber as the key. This way, you'll never get a null value so your problem disappears. Users shouldn't see the PK so it makes no difference.
 
There are differing views on this, but I always use an autonumber as the PK. If you want a different reference number as well, that's fine, but consider using an autonumber as the key. This way, you'll never get a null value so your problem disappears. Users shouldn't see the PK so it makes no difference.

so it would be bookingPK, bookingID, .....,
FunctionPK, FunctionID, BookingID

or do the relationships have to involve a primary key
or does it not really matter
 
so it would be bookingPK, bookingID, .....,
FunctionPK, FunctionID, BookingID

or do the relationships have to involve a primary key
or does it not really matter
They don't have to involve a primary Key. Just a unique value from the 1 side of the relationship.

However, in your case because your Booking ID is a string it would be better to use the autonumber for the link. This is because a string takes up more space than a long integer and the integer indexes more efficiently.
 
They don't have to involve a primary Key. Just a unique value from the 1 side of the relationship.

However, in your case because your Booking ID is a string it would be better to use the autonumber for the link. This is because a string takes up more space than a long integer and the integer indexes more efficiently.

thanks for the advice, i will change that now and see if that fixes things

if not

ILL BE BACK ;) (in an Arnie style voice)
 
ok this seems to be working now cheers for all the help/advice
 

Users who are viewing this thread

Back
Top Bottom