I think the issue is my SQL statement. I went back and made the enterNewHardware function into a class and inherited the hardwareTab class. I feel this has been the closest way so far because I have access to both the text boxes and database this way. I have gotten to the point now where my variables are being referenced in the SQL statement(no longer grayed out)....still clicking the button makes the cursor spin for a second, app exits and no data entered. I took out the SELECT statement because I don't see why it would be needed. I got the original sql statement from microsoft to test the connection to the database.
from PyQt5.QtWidgets import (QLabel, QPushButton, QLineEdit, QApplication, QCheckBox, QMainWindow, QWidget, QVBoxLayout, QTabWidget, QStatusBar) import pyodbc import sys class mainWindow(QMainWindow): def __init__(self): super().__init__() self.resize(385, 323) self.setWindowTitle("HARDWARE | SOFTWARE MANAGER") self.statusBar = QStatusBar() self.setStatusBar(self.statusBar) self.tabForm = QTabWidget() self.tabForm.addTab(hardwareTab(), "HARDWARE") self.tabForm.addTab(softwareTab(), "SOFTWARE") self.setCentralWidget(self.tabForm) class hardwareTab(QWidget): def __init__(self): super().__init__() self.snLabel = QLabel("SERIAL NUMBER") self.snTextBox = QLineEdit() self.modelLabel = QLabel("MODEL") self.modelTextBox = QLineEdit() self.userLabel = QLabel("USER") self.userTextBox = QLineEdit() self.enButton = QPushButton("ENTER NEW HARDWARE") self.cfButton = QPushButton("CLEAR FIELDS") self.seButton = QPushButton("SEARCH/EDIT HARDWARE") self.activeCheckbox = QCheckBox("ACTIVE") layout = QVBoxLayout(self) layout.addWidget(self.snLabel) layout.addWidget(self.snTextBox) layout.addWidget(self.modelLabel) layout.addWidget(self.modelTextBox) layout.addWidget(self.userLabel) layout.addWidget(self.userTextBox) layout.addWidget(self.activeCheckbox) layout.addWidget(self.enButton) layout.addWidget(self.cfButton) layout.addWidget(self.seButton) self.enButton.clicked.connect(enterNewHardware) class softwareTab(QWidget): def __init__(self): super().__init__() self.snLabel = QLabel("SERIAL NUMBER / KEY") self.snTextbox = QLineEdit() self.nameLabel = QLabel("APPLICATION NAME") self.nameTextBox = QLineEdit() self.userLabel = QLabel("USER") self.userTextBox = QLineEdit() self.enButton = QPushButton("ENTER NEW SOFTWARE") self.cfButton = QPushButton("CLEAR FIELDS") self.seButton = QPushButton("SEARCH/EDIT SOFTWARE") layout = QVBoxLayout(self) layout.addWidget(self.snLabel) layout.addWidget(self.snTextbox) layout.addWidget(self.nameLabel) layout.addWidget(self.nameTextBox) layout.addWidget(self.userLabel) layout.addWidget(self.userTextBox) layout.addWidget(self.enButton) layout.addWidget(self.cfButton) layout.addWidget(self.seButton) class enterNewHardware(hardwareTab): def __init__(self): super().__init__() serial_number = self.snTextBox.text() model_name = self.modelTextBox.text() user_name = self.userTextBox.text() active_machine = self.activeCheckbox.setChecked() azureServer = "pythonserver5874.database.windows.net" azureDB = "inventoryDatabase" userName = "na" password = "na" driver = "{ODBC Driver 17 for SQL Server}" connectionString = f"DRIVER={driver};SERVER={azureServer};PORT=1433;DATABASE={azureDB};UID={userName};PWD={password}" conn = pyodbc.connect(connectionString) cursor = conn.cursor() cursor.execute("INSERT INTO inventoryDatabase.dbo.Hardware VALUES (%s, %s, %s, %s)", (serial_number, model_name, user_name, active_machine)) conn.commit() #sqlCMD.execute('SELECT * FROM inventoryDatabase.dbo.Hardware') #sqlCMD.execute(''' #INSERT INTO inventoryDatabase.dbo.Hardware(serialNumber, modelName, userName, machineActive) #VALUES #(serial_number, model_name, user_name, active_machine) #''') #conn.commit() if __name__ == "__main__": APP = QApplication(sys.argv) WINDOW = mainWindow() WINDOW.show() sys.exit(APP.exec_())