Reputation: 350
I am programming an Access form which needs to print. Since I am not developing the form on the same computer as the computer it will be used on, I can't be sure the printers name will be the same and if it will be the standard printer. My first attempt was to list all printers using Application.Printers
.
The problem is that I can't find a pattern in the devices name or anything to identify the right printer. Is there any smart attempt on this, using for example the MAC adress or the IP of the printer?
Upvotes: 0
Views: 363
Reputation: 32672
Non-networked printers don't have unique identifiers. The combination printer name + computer name should be unique, though.
For networked printers, you can try using the .Port
property to identify a certain printer. However, this property is configurable, and is a string.
If you want to get the IP address of a certain printer, you will have to use the EnumPorts
function (MSDN) to get the available ports and their associated IP addresses. Since that's a C++ function, that's not very easy. Then, using the .Port
property, you can identify which printer is using that port.
Upvotes: 1