In this case, the Run-time error actually tells you what the problem is.
The two different fields in your criteria are not of the same data type - so Access cannot evaluate the = sign that is between them because it would be like comparing apples to oranges.
In your DLookup() function:
Code:
If IsNull(DLookup("DVDsID", "Rentals", "DVDsID=" & DVDID)) Then
. . . where are you getting the 'Value' that is in 'DVDID'?
Before the snippet that you posted . . . is there a line of code in which you assign the value that is in the DVDID text box to 'DVDID'?
For example, do you have code that says something like:
Code:
Dim DVDID as Integer '[or 'as String' if DVDsID in your Rentals table is defined as Text].
DVDID = Me.txtDVDID '[where txtDVDID is the name of the text box on your Form].
?
The second line would assign the value that is in the text box to the variable 'DVDID'
You could try putting the code in the 'On Current' Event of the Form - so that each time there is a new record on the Form - the code will fire off & deal with teh check box.
Something is nagging at the back of my mind, though.
I feel like if I had designed this, I would just have a 'Boolean' field in the Rentals table that is True if the DVD is in stock - or False if it is rented out.
Then - you wouldn't need any code on the Form - your check box on the Form will automatically be checked if that field is True in the table and not-checked if that field is False.
I hope this helps.