andrewhoddie
Board Regular
- Joined
- Dec 21, 2008
- Messages
- 114
Hi all
I am using Access 2016 and an ODBC link to an SQL Database.
I have a form called "Search" which returns values into two sub forms ServiceUsersSearchList for current clients and TerminatedSericUsersSearch for former clients.
The results show ClientID, Address1, Address2, Postcode from table dbo_Voids the user clicks on the row and clicks on AddRent button.
This opens up a form called Rents where there is a field called ClientID from table dbo_rents, The two clientIDs are linked. What I would like is for the ClientID from the search to prepopulate on the Rents form.
I am using the following code:
Private Sub AddRent_Click()
On Error GoTo Err_AddRent_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Rents"
stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_AddRent_Click:
Exit Sub
Err_AddRent_Click:
MsgBox Err.Description
Resume Exit_AddRent_Click
End Sub
Any help greatly appreciated.
thanks
Andrew
I am using Access 2016 and an ODBC link to an SQL Database.
I have a form called "Search" which returns values into two sub forms ServiceUsersSearchList for current clients and TerminatedSericUsersSearch for former clients.
The results show ClientID, Address1, Address2, Postcode from table dbo_Voids the user clicks on the row and clicks on AddRent button.
This opens up a form called Rents where there is a field called ClientID from table dbo_rents, The two clientIDs are linked. What I would like is for the ClientID from the search to prepopulate on the Rents form.
I am using the following code:
Private Sub AddRent_Click()
On Error GoTo Err_AddRent_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Rents"
stLinkCriteria = "[ClientID]=" & Me![ClientID]
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_AddRent_Click:
Exit Sub
Err_AddRent_Click:
MsgBox Err.Description
Resume Exit_AddRent_Click
End Sub
Any help greatly appreciated.
thanks
Andrew