I'm gonna assume from your comments so far, that you have a stand-alone digital workstation, such as a roland or fostex or whatever - I also assume that the way you talk about it, you're using the recorder as the MASTER, and the drum machine has to sync to the recorder - several of these standalone recorders can OUTPUT sync, but can NOT be the SLAVE.
If my assumptions are right, then I hope your recorder has a MIDI IN - if so, the keyboard would have to be connected to that, soft thru turned on in the recorder, and the output of the recorder going to the drum machine. That way, the drum machine gets sync from the recorder, and keyboard control from the input of the recorder, THRU its output and into the drum machine.
If your recorder does NOT have a MIDI input, or for some reason won't allow you to turn on SOFT THRU in one of the menus, then the only other way I know to do this is with an external MIDI MERGE box. Here is a link to one - Musician's Friend carries the 4 and 8 input units, they may also have the two input I'm linking to.
http://www.midisolutions.com/prodmrg.htm
To use this in your situation, you would take the MIDI output of your recorder IN to the merge box #1, the keyboard MIDI output into the merge box IN #2, and the output of the merge box to the drum machine IN.
Here is the link to Musicians Friend with the 2 input unit -
http://www.musiciansfriend.com/srs7...8171099005/search/g=home/detail/base_id/45741
Hopefully your recorder lets you merge midi input, and has the soft-thru function - it's $59.99 cheaper... Steve