We don’t care what the four-of-a-kind is; as long as there are all four suits of a card this is good enough.
We need to look at the worst possible case to find a minimum number of cards to guarantee we get four that match. This would be mean that the last card dealt, whatever it is, is the card that completes the four-of-a-kind. This means that, of the cards already dealt, there must be three of every possible number already out; any more, and there would already be four-of-something. Any fewer, and there would not be three of each, so that the next card might not guarantee to make four.
So, before the last, card there must have been 39 cards dealt (3 × 13). Whatever the fortieth card is, it will quad up with three others that have already been dealt.