How would I set a variable to a field that is in a table not controlled by the current form?
The form I'm trying update is controlled by the Issues table, and I need to grab tblWithGroup.ID as string GID
Problem is, the Issues table also has a field called ID...so when I set the variable to ID it is automatically pulling the Issues.ID, not the tblWithGroup.ID
When I put a stop and watch what is happening, I see it update the group_ID with the ID from the Issues table, so the code is working (I think), just not how I want it to!
The form I'm trying update is controlled by the Issues table, and I need to grab tblWithGroup.ID as string GID
Problem is, the Issues table also has a field called ID...so when I set the variable to ID it is automatically pulling the Issues.ID, not the tblWithGroup.ID
Private Sub with_group_AfterUpdate()
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("tblWithGroup")
With rs
If Me!group_ID = Null Then
Me!group_ID = Null
Else
If Me!group_ID = ID Then
.Edit
!End_Date = Date
End If
End If
Dim GID As String
GID = ID 'Needs to pull ID from tblWithGroup.ID
.AddNew
!Issue_ID = Me.ID
!Old_Group = OldGroup
!Group = Me.with_group
!Start_Date = Date
Me!group_ID = GID
.Update
End With
If Not rs Is Nothing Then
rs.Close
Set rs = Nothing
End If
Exit Sub
End Sub
When I put a stop and watch what is happening, I see it update the group_ID with the ID from the Issues table, so the code is working (I think), just not how I want it to!