Can someone please let me know why this isn't working? I'm trying to take the difference of two fields from two separate spreadsheets. I believe it's only reading from the first spreadsheet (tlbLatexBatch QC) and not the other. Any help would be greatly appreciated.
Dim con As Object
Dim rs As Object
Dim stSql As String
Dim currentweight As Long
Set con = Application.CurrentProject.Connection
stSql = "SELECT Sum(tblLatexBatchQC.[TransferredWeight]) - Sum([Blendsheet Ouptput].Weight) AS currentweight"
stSql = stSql & " WHERE tblLatexBatchQC.[TankNum] = [Blendsheet Output].TankN" & Me.cmbTankNum & ""
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1
TxtCurrentWeight.SetFocus
currentweight = TxtCurrentWeight.Text
Dim con As Object
Dim rs As Object
Dim stSql As String
Dim currentweight As Long
Set con = Application.CurrentProject.Connection
stSql = "SELECT Sum(tblLatexBatchQC.[TransferredWeight]) - Sum([Blendsheet Ouptput].Weight) AS currentweight"
stSql = stSql & " WHERE tblLatexBatchQC.[TankNum] = [Blendsheet Output].TankN" & Me.cmbTankNum & ""
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1
TxtCurrentWeight.SetFocus
currentweight = TxtCurrentWeight.Text