akn112
01-25-2007, 12:20 PM
Hey again, here's another question
Say i have two tables. how would i make it so that when i click a button, it will take the first entry of the list and compare it against all other entries of the other list. If the program finds one entry that is equal, it goes to the next entry in the first list. If it doesnt find one it saves the entry(in another table called difference) and goes to the next entry. It continues to do this for the rest of the list. Right now i have
Private Sub Toggle7_Click()
Dim strsql As String
Record1:
If Me![DS].Form![Name] = Me![export_psdb].Form![Station] Then
GoTo NextRecord
Else
DoCmd.GoToControl "export_psdb"
DoCmd.GoToRecord
If Me![export_psdb].Form![Station] <> Null Then
GoTo Record1
Else
GoTo CreateDifference:
End If
End If
Exit_now:
Exit Sub
NextRecord:
DoCmd.GoToControl "DS"
DoCmd.GoToRecord
If Me![DS].Form![Name] = Null Then
GoTo Exit_now
End If
GoTo Record1
CreateDifference:
strsql = "UPDATE [Difference] SET [Difference].[Station Name] = forms![DS]!Name "
DoCmd.GoToControl "Differences"
DoCmd.GoToRecord
GoTo NextRecord
End Sub
Say i have two tables. how would i make it so that when i click a button, it will take the first entry of the list and compare it against all other entries of the other list. If the program finds one entry that is equal, it goes to the next entry in the first list. If it doesnt find one it saves the entry(in another table called difference) and goes to the next entry. It continues to do this for the rest of the list. Right now i have
Private Sub Toggle7_Click()
Dim strsql As String
Record1:
If Me![DS].Form![Name] = Me![export_psdb].Form![Station] Then
GoTo NextRecord
Else
DoCmd.GoToControl "export_psdb"
DoCmd.GoToRecord
If Me![export_psdb].Form![Station] <> Null Then
GoTo Record1
Else
GoTo CreateDifference:
End If
End If
Exit_now:
Exit Sub
NextRecord:
DoCmd.GoToControl "DS"
DoCmd.GoToRecord
If Me![DS].Form![Name] = Null Then
GoTo Exit_now
End If
GoTo Record1
CreateDifference:
strsql = "UPDATE [Difference] SET [Difference].[Station Name] = forms![DS]!Name "
DoCmd.GoToControl "Differences"
DoCmd.GoToRecord
GoTo NextRecord
End Sub