Andreita_IEA
New member
- Local time
- Yesterday, 21:00
- Joined
- Nov 4, 2013
- Messages
- 3
Good evening.
Im trying to compare two tables (Sap table and Operational_Technical table)
Both has the following fields:
Sap Table:
SAP_Aircraft
SAP_DMI_Number
and the Operational_Technical table has:
MatriculaReal
DMI_Number
What Im trying to do is compare the fields "SAP_Aircraft" and "MatriculaReal" and if the program finds any difference shows a message telling me that.
This is the code Im using: (But it seems like the "Move next" doesnt move from the next "Matricula") It does make sense?
Private Sub Form_Load()
txtUser.Value = Gbl_Nombre
DoCmd.Maximize
Dim rsT As Recordset 'Recordset from Operational_Technical table
Dim rsS As Recordset 'Recordset from Sap Table
Dim txtSql As String
Dim SapMatricula As String
Dim AccessMatricula As String
Set rsS = CurrentDb.OpenRecordset("SAP", dbOpenDynaset)
Set rsT = CurrentDb.OpenRecordset("Operational_Technical", dbOpenDynaset)
SapMatricula = SapMatricula & rsS.Fields("SAP_Aircraft").Value
AccessMatricula = AccessMatricula & rsT.Fields("MatriculaReal").Value
Do While Not rsS.EOF Or rsT.EOF
If (SapMatricula = AccessMatricula) Then
MsgBox "Differences not found"
Else
MsgBox "Differences found"
End If
rsS.MoveNext
MsgBox "The currently registration is " & SapMatricula
Loop
rsS.Close
MsgBox "End"
End Sub
Im trying to compare two tables (Sap table and Operational_Technical table)
Both has the following fields:
Sap Table:
SAP_Aircraft
SAP_DMI_Number
and the Operational_Technical table has:
MatriculaReal
DMI_Number
What Im trying to do is compare the fields "SAP_Aircraft" and "MatriculaReal" and if the program finds any difference shows a message telling me that.
This is the code Im using: (But it seems like the "Move next" doesnt move from the next "Matricula") It does make sense?
Private Sub Form_Load()
txtUser.Value = Gbl_Nombre
DoCmd.Maximize
Dim rsT As Recordset 'Recordset from Operational_Technical table
Dim rsS As Recordset 'Recordset from Sap Table
Dim txtSql As String
Dim SapMatricula As String
Dim AccessMatricula As String
Set rsS = CurrentDb.OpenRecordset("SAP", dbOpenDynaset)
Set rsT = CurrentDb.OpenRecordset("Operational_Technical", dbOpenDynaset)
SapMatricula = SapMatricula & rsS.Fields("SAP_Aircraft").Value
AccessMatricula = AccessMatricula & rsT.Fields("MatriculaReal").Value
Do While Not rsS.EOF Or rsT.EOF
If (SapMatricula = AccessMatricula) Then
MsgBox "Differences not found"
Else
MsgBox "Differences found"
End If
rsS.MoveNext
MsgBox "The currently registration is " & SapMatricula
Loop
rsS.Close
MsgBox "End"
End Sub