Before choosing between them, you should think of the best possible version of each one. Eg:
Text Box
You could let the user type freely but also offer some default options to make them easier for them (Google Calendar does this)
In the case the possible values are not too much you could offer an spinner
Slider
I suggest to read this N.Nielsen article Slider Design: Rules of Thumb.
I'll quote its summary and conclusion:
Summary
Selecting a precise value using a slider is a difficult
task requiring good motor skills, even if the slider is well
designed. If picking an exact value is important to the goal of
the interface, choose an alternate UI element.
Conclusion
Use a slider only when the precise value won’t matter to
the user, but rather only the approximate range. Make sure that the
users can select that range correctly without having to struggle too
much to hit a precise value. In addition, any slider labels must be
displayed above or beside the slider, rather than below it, in order
to remain visible while the user is selecting a value. Alternatively,
consider a different UI element that allows users to tap or even type
to specify their choice rather than relying on press-and-drag
gestures.
Final comment
You need precision so go for the text box, just try to enhance it with another control if possible (which should be chosen depending on each scenario) to offer users some completion shortcuts.