Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updateable query

Status
Not open for further replies.

rich001

Programmer
Feb 24, 2006
9
0
0
US
The attached is giving me fits. Is there any way to make this query updateable and still do the some thing? I need to beable to view [Expr1] because it validates a field in my table.

SELECT Personnel.*, (SELECT DutySection FROM Personnel WHERE SSN=[What is your SSN]) AS Epr1, *
FROM Personnel
WHERE (((Personnel.SSN)=[What is your SSN])) OR ((((SELECT DutySection FROM Personnel WHERE SSN=[What is your SSN])) In ('Admin','Support')));
 
The following is updatable. Is that what you want?

SELECT Personnel.*, Personnel.SSN, Personnel.DutySection, *
FROM Personnel
WHERE (((Personnel.SSN)=[What is your SSN])) OR (((Personnel.DutySection) In ('Admin','Support')));
 
I figured it out using code and a login form instead of a query. I just got this working. Thanks

Private Sub txtSSN_AfterUpdate()

Dim strDuty As String
strDuty = DLookup("DutySection", "Personnel", "SSN = '" _ & Me!txtSSN & "'")
If strDuty = "Admin" Or strDuty = "Support" Then
DoCmd.OpenForm "Personnel"
Else
DoCmd.OpenForm "Personnel", , , "SSN = '" & Me!txtSSN & "'"
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top