MS Access Help (Simple one)
#1
Scooby Senior
Thread Starter
Hi,
I need to know the syntax for SQL to select JUST the current record into a new table.
Currently the code says this
SELECT Help.CallNumber, Help.EmployeeID, Help.AssetID, Help.DateRaised, Help.Priority, Help.ProblemDescription, Help.Description, Help.Solution, Help.DateCompleted INTO Open
FROM Help
WHERE (((Help.DateCompleted) Is Null));
This makes a table which shows all calls without a completion date.
What I really really need is SQL that makes a table that ONLY has the current selected record.
Anyone got the answer
I need to know the syntax for SQL to select JUST the current record into a new table.
Currently the code says this
SELECT Help.CallNumber, Help.EmployeeID, Help.AssetID, Help.DateRaised, Help.Priority, Help.ProblemDescription, Help.Description, Help.Solution, Help.DateCompleted INTO Open
FROM Help
WHERE (((Help.DateCompleted) Is Null));
This makes a table which shows all calls without a completion date.
What I really really need is SQL that makes a table that ONLY has the current selected record.
Anyone got the answer
#2
What do you mean "current selected" - where is it selected?
Do you mean you select something on a form somewhere and u want to look it up, or do you mean the "latest" record?
Confused.
What you want to do should be very simple, but I don't know what you want to do - I'm being thick today.
Do you mean you select something on a form somewhere and u want to look it up, or do you mean the "latest" record?
Confused.
What you want to do should be very simple, but I don't know what you want to do - I'm being thick today.
#3
Scooby Senior
Thread Starter
I have a form that users fill in to build their record.
this data is added to the Help table which has multiple records.
What I need is the button on that runs a query which makes another Table which contains only the current record that they have selected on the form.
If that makes sense
this data is added to the Help table which has multiple records.
What I need is the button on that runs a query which makes another Table which contains only the current record that they have selected on the form.
If that makes sense
#4
Scooby Senior
Thread Starter
something like
SELECT Help.CallNumber, Help.EmployeeID, Help.AssetID, Help.DateRaised, Help.Priority, Help.ProblemDescription, Help.Description, Help.Solution, Help.DateCompleted INTO Open
FROM Help
WHERE (((Help.record) Is CurrentRecord));
but SQL that works
SELECT Help.CallNumber, Help.EmployeeID, Help.AssetID, Help.DateRaised, Help.Priority, Help.ProblemDescription, Help.Description, Help.Solution, Help.DateCompleted INTO Open
FROM Help
WHERE (((Help.record) Is CurrentRecord));
but SQL that works
#5
I guess callnumber is the primary key?
In which case, add a "where" clause to the sql that says something along the lines of...
WHERE callnumber = forms!yourformnamehere!callnumber
In which case, add a "where" clause to the sql that says something along the lines of...
WHERE callnumber = forms!yourformnamehere!callnumber
#6
Scooby Senior
Thread Starter
Button had this code
Private Sub CurrentCall_Click()
On Error GoTo Err_CurrentCall_Click
Dim stDocName As String
stDocName = "Current_Call"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_CurrentCall_Click:
Exit Sub
Err_CurrentCall_Click:
MsgBox Err.Description
Resume Exit_CurrentCall_Click
End Sub
Query was thus
SELECT Help.CallNumber, Help.EmployeeID, Help.AssetID, Help.DateRaised, Help.Priority, Help.ProblemDescription, Help.Description, Help.Solution, Help.DateCompleted INTO Open
FROM Help
WHERE (((Help.CallNumber)=[Forms]![Help]![CallNumber]));
Tada - It works perfectly (almost) Me happy
Private Sub CurrentCall_Click()
On Error GoTo Err_CurrentCall_Click
Dim stDocName As String
stDocName = "Current_Call"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_CurrentCall_Click:
Exit Sub
Err_CurrentCall_Click:
MsgBox Err.Description
Resume Exit_CurrentCall_Click
End Sub
Query was thus
SELECT Help.CallNumber, Help.EmployeeID, Help.AssetID, Help.DateRaised, Help.Priority, Help.ProblemDescription, Help.Description, Help.Solution, Help.DateCompleted INTO Open
FROM Help
WHERE (((Help.CallNumber)=[Forms]![Help]![CallNumber]));
Tada - It works perfectly (almost) Me happy
Thread
Thread Starter
Forum
Replies
Last Post
Phil3822
General Technical
0
30 September 2015 06:29 PM