A
Andrew
My form is based on a OUTER JOIN query. The user wants a note field
(actually containing the client’s vendor preferences) based on the client_ID
which is chosen from a combo box. The client_ID is taken from a linked table
in a SQL Server database that I’m not allowed to touch. So, I created
another table (CLIENT_SUPPLEMENT) with two columns: Client_Id (Primary Key),
Vendor_Information, and added the table to the OUTER JOIN.
On the form, the Vendor_Information control is editable if there is a
client_ID in the CLIENT_SUPPLEMENT table that matches the client_ID (from the
aforementioned linked table) displayed in the form. However, it is,
logically, not enterable if there no row exists for a client in
CLIENT_SUPPLEMENT.
I grab the client_ID from the form record, INSERT it into the
CLIENT_SUPPLEMENT table, requery. I do this on the ON ENTER event of the
vendor_information control. The INSERT works, but for some reason I have to
close the form and reopen it before I can edit vendor_information. How can I
make that field enterable?
Private Sub Vendor_Information_Enter()
Dim strSQL As String
On Error GoTo Err_Vendor_Information_Enter
strSQL = "INSERT INTO client_supplement (client_ID) " & _
"VALUES (""" & Me![client_ID] & """);"
DoCmd.RunSQL strSQL
Me.Requery
Err_Vendor_Information_Enter:
‘ code to handle primary key violation
Exit Sub
End Sub
(actually containing the client’s vendor preferences) based on the client_ID
which is chosen from a combo box. The client_ID is taken from a linked table
in a SQL Server database that I’m not allowed to touch. So, I created
another table (CLIENT_SUPPLEMENT) with two columns: Client_Id (Primary Key),
Vendor_Information, and added the table to the OUTER JOIN.
On the form, the Vendor_Information control is editable if there is a
client_ID in the CLIENT_SUPPLEMENT table that matches the client_ID (from the
aforementioned linked table) displayed in the form. However, it is,
logically, not enterable if there no row exists for a client in
CLIENT_SUPPLEMENT.
I grab the client_ID from the form record, INSERT it into the
CLIENT_SUPPLEMENT table, requery. I do this on the ON ENTER event of the
vendor_information control. The INSERT works, but for some reason I have to
close the form and reopen it before I can edit vendor_information. How can I
make that field enterable?
Private Sub Vendor_Information_Enter()
Dim strSQL As String
On Error GoTo Err_Vendor_Information_Enter
strSQL = "INSERT INTO client_supplement (client_ID) " & _
"VALUES (""" & Me![client_ID] & """);"
DoCmd.RunSQL strSQL
Me.Requery
Err_Vendor_Information_Enter:
‘ code to handle primary key violation
Exit Sub
End Sub