Hello
I have working code, but i need bit tweek.
So There is a table "Visitors Book - Personal", with Fields: "ID","Unique Code","Surname","First Name",etc
Now! When I press ENTER button it check if exists, ( It Works ), on the end is little code which takes ID and changes to "Unique Code" that is fine too. !!! What I need is somehow to transfer The "Unique Code" to another table called "Visitors Book - Visits". I have tried to create croostable query but didn't work. Could that be linking criteria or Another Link. Please Help!!!
Private Sub CommandENTER_Click()
Dim stExist As String
Dim stNoExist As String
Dim stLinkCriteria As String
Dim I As Integer
I = DCount("[First Name]", "[Visitors Book - Personal]", "[First Name] ='" & Forms![Visitors Book In]![First Name] & "'")
Y = DCount("[Surname]", "[Visitors Book - Personal]", "[Surname] ='" & Forms![Visitors Book In]![Surname] & "'")
If I > 0 And Y > 0 Then
MsgBox "Already exist!"
Else
stNoExist = "Confirmation noexist"
DoCmd.OpenForm stNoExist, , , stLinkCriteria
End If
Me.UniqueCode = "Chill" & [ID] + 1
End Sub
Thanks
I have working code, but i need bit tweek.
So There is a table "Visitors Book - Personal", with Fields: "ID","Unique Code","Surname","First Name",etc
Now! When I press ENTER button it check if exists, ( It Works ), on the end is little code which takes ID and changes to "Unique Code" that is fine too. !!! What I need is somehow to transfer The "Unique Code" to another table called "Visitors Book - Visits". I have tried to create croostable query but didn't work. Could that be linking criteria or Another Link. Please Help!!!
Private Sub CommandENTER_Click()
Dim stExist As String
Dim stNoExist As String
Dim stLinkCriteria As String
Dim I As Integer
I = DCount("[First Name]", "[Visitors Book - Personal]", "[First Name] ='" & Forms![Visitors Book In]![First Name] & "'")
Y = DCount("[Surname]", "[Visitors Book - Personal]", "[Surname] ='" & Forms![Visitors Book In]![Surname] & "'")
If I > 0 And Y > 0 Then
MsgBox "Already exist!"
Else
stNoExist = "Confirmation noexist"
DoCmd.OpenForm stNoExist, , , stLinkCriteria
End If
Me.UniqueCode = "Chill" & [ID] + 1
End Sub
Thanks