I have never tried that but I have read the following:
If the marijuana is to be stored for more than a few months, you can use a
vacuum sealer (designed for storing food) to seal the marijuana in an airtight environment. If stored in a dark area that is between 40-55 degrees F, the marijuana in vacuum sealed plastic will remain potent for up to 5 years.
Dry marijuana can be stored in a frost-free freezer, but some of the THC on the outer part of the buds may be damaged when frozen. A refrigerator is in the right temperature range but they tend to be humid (unless you can control the humidity).
If stored in an area of high humidity for months or years, even vacuum sealed marijuana can eventually become as humid as the surrounding air. This will necessitate drying it again before smoking. But, unless mold develops, humidity itself will not degrade the THC or make the marijuana any less potent.
Light will degrade some of the THC, so dark containers can be used for storage. If you place the marijuana in a see through container, it will have to be located in a dark area that is not exposed to light or high temperatures.
Always make sure to properly dry your marijuana prior to storage, if you grow your own or if the stuff you have is very moist.
And remember that to preserve marijuana potency at a maximum level, keep any exposure to air, heat, and light at a minimum.