I am using iCloud Back to my Mac to access my iMac at home, I was able to access it for a moment before accidentally connecting it to my VPN and cutting off the connection. Later I had my VPN disconnected from the iMac, but then after that I think the iMac had went into sleep mode since it's not on my device list anymore when just moments ago it was and fully accessible, Find My iPhone also wasn't able to locate it so it should be in sleep mode now, I'm not sure if I have Wake for network access enabled on my iMac, thats why I need a soluton to force my iMac to wake up so I can access everything again and make sure that wake for network access is enabled.
You are supposed to be able to set the machine to wake on network access in the Energy Saver settings in System Preferences:
In theory, this should work if you are using an Apple AirPort base station (which should include a Time Capsule). In practice, I've never gotten it to work wirelessly. If you have the iMac connected via Ethernet cable to the Time Capsule, it ought to work.
Of course, if you are currently away from the iMac, there's nothing you can do if it's not already set up appropriately for remote access and remote waking.
Edit: I note that you posted this while I was replying:
I was able to access it for a moment before accidentally connecting it to my VPN and cutting off the connection.
I'm not sure what that means, but if you had it working before and changed the network configuration of the iMac, chances are good the problem isn't sleep but the network change.
Yes I know that you can enable that in System Preferences, but I'm not sure if I have I have it enabled and I can't check because I can't access my computer now, because it went to sleep and is no longer registered on the network. I'm only here to look for a solution so I can remotely force my computer to wake up so I can access it again.
Sorry I missed the second half of your message.
What I was trying to say is that I have my VPN client (Viscosity) to automatically launch and connect my VPN on log in. And it did that shortly after I logged into my iMac remotely, because of the network change I lost the connection with my iMac, and for some reason Back To My Mac doesn't seem to work over VPN network. Later I changed the base server for my VPN and that disconnected my iMac from the VPN (because I was able to connect to my VPN on my MacBook Pro and I can only connect one device at a time). Now that I am certain my iMac is no longer connected to my VPN, it should be back to normal as it had before, however I waited forever and it still didn't turn up on my Shared menu in Finder, I checked Find My iPhone and it failed to locate my iMac when moments ago when I can access my iMac remotely Find My iPhone was still able to locate my iMac. Sorry if this sounds a little complex I'm not very good at describing situations.
I'm only here to look for a solution so I can remotely force my computer to wake up so I can access it again.
Unfortunately, whether you have changed the network settings on the iMac or it has gone to sleep without "Wake for network access" turned on, there's nothing you can do from your current location to fix the problem. Physical access to the machine by someone will be needed to fix whatever has gone wrong and make it accessible again.