If you are in Zürich, take a train from Zürich to Venice. If you are in Bern, take a train from there to Venice.
Where are you actually starting from? What is the nearest station or bus stop to that location?
Go to the SBB (Swiss Railways) website: https://www.sbb.ch/en
Enter from: where you are actually starting from, to: Venezia S. Lucia, plus date and time.
Then click on "Search", and it will find you all possible trains.
All trains from Switzerland to Venice go via Milan. Sometimes you have to change trains there, sometimes not.
This is a long trip, depending on where you are starting from it could be 8 hours or more. You will need to start mid-afternoon latest if you are to get to Venice the same day.
As this will involve Swiss trains, a cross-border train and Italian trains, you will probably have to split the purchase. Buy the Swiss trains on the SBB site, and the cross-border and Italian trains on the Trenitalia (Italian Railways) website.