Error if nothing selected in Combobox (1 Viewer)

sbuckingham25

Registered User.
Local time
Yesterday, 19:51
Joined
Jun 12, 2008
Messages
27
I have a combo box in a form. If nothing is selected, I get this error:

The Micro Jet databse engine cannot find a record int the table "TblParts'with key matching field(s) 'Parts'.

Is there a way to have the field null, there will be jobs that Parts won't need to be selected.
 

K1Kingy

Registered User.
Local time
Today, 11:51
Joined
Jun 12, 2008
Messages
20
I believe you get this error because you have a relationship between the two fields, so basically what you've told it to do is when you add a job then there will NEED to be a part selected. So i think if you fix the relationship up, you should be good. I think this is right, I'm still kind of new to Access so i might be wrong.
 

dreamdelerium

Registered User.
Local time
Yesterday, 16:51
Joined
Aug 24, 2007
Messages
88
error handling

so it works if the combo's have a value? are you handling errors? if not, just catch the error and do something with it. to do that try:
Code:
Public Sub SomeSubOrFunction
On Error GoTo errorhandler
 
'your code....
 
errorhandler:
If Err.Number = 0 Then
elseif err.number =  25 then  'change this number to your errornumber
msgbox("Im sorry, you must make a selection")
Else
MsgBox (Err.Description)
' if you dont know the error number to cach, 
'change description to number and see what pops

End If
End Sub
 

khawar

AWF VIP
Local time
Today, 03:51
Joined
Oct 28, 2006
Messages
870
change the default value of the field part in your table from 0 to null
no need to ammend any relationships

Khawar
 

Users who are viewing this thread

Top Bottom