Tools >> Data Connections >> Add >> Create a new connection to: Receive Data >> Select SharePoint library or list >> enter the url of the form library (the same address that you published the form to.
Then Select the library you want to access and click Next. Check the “ID ” Field and any other field you would want to retrieve.
At the bottom check *Include data for the active form only*, which means this connection will only retrieve data for the form that is currently open. Click Next and finish creating your data connection.
Then in the Text field properties, you can set this ID or other field as the Default Value.