Welcome to the forums, flaghippo!
Yes, you can do a day trip from Budapest to Vienna. The ride via train takes about three hours and trains run frequently (almost every 2nd hour) between Budapest’s Keleti Station and Vienna’s Westbahnhof. A return ticket is about EUR 25. Tickets are available online at mav-start.hu. Another option would be to take the bus. The ride takes 2 hours and 55 minutes and a return ticket costs about EUR 30. Buses leave from the Népliget bus terminal. Tickets are available online at eurolines.hu.
Have a nice trip!