SerialPort.LastError
--------------------

Returns the system error from last serial port function call.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [SerialPort](component_SerialPort.md) | [3.3](newinversion33.md) | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes, on macOS and Windows | ❌ No |

MBS( "SerialPort.LastError"; PortReference ) 

**MBS**( **"SerialPort.LastError";** /\* Returns the system error from last serial port function call. \*/  
**$PortReference**) /\* The reference number of the port. You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port.e.g. $port \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PortReference | The reference number of the port. You get this number from [SerialPort.Open](SerialPortOpen.md) when you open the port. | $port |

### Result

Returns error code.

### Description

Returns the system error from last serial port function call.  
The error code is zero for no error.  
On Windows you get the windows system error codes and on macOS the unix system error codes.  
### See also

- [SerialPort.Open](SerialPortOpen.md)

### Blog Entries

- [MBS Filemaker Plugin, version 3.3pr5](https://www.mbsplugins.de/archive/2013-07-03/MBS_Filemaker_Plugin_version_3/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 10th August 2020

  
[SerialPort.IsSuspended](SerialPortIsSuspended.md) - [SerialPort.List](SerialPortList.md)

[HTML Version](SerialPortLastError.shtml)