473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

A2K3- quick SQL help needed

This is the raw SQL from a saved delete query - I need to assign this to a
string so I can execute it using DoCmd.RunSQL. The value of 1 needs to be
replaced with a reference to Me.txtPupilID. Other than that I can't get the
syntax correct. Can anyone correct it for me, it's a bit trial and error
here....

DELETE tblPupilIncidentLink.*, tblPupilIncidentLink.PupilID,
tblPupilIncidentLink.IncidentID
FROM tblPupilIncidentLink
WHERE (((tblPupilIncidentLink.PupilID)=1) AND
((tblPupilIncidentLink.IncidentID)=[forms]![frmIncidentsListBox_version].[In
cidentID]));
Jan 10 '06 #1
4 1207
Try this:

Dim strSQL

strSQL = "DELETE tblPupilIncidentLink.PupilID " & _
" FROM tblPupilIncidentLink " & _
"WHERE (((tblPupilIncidentLink.PupilID)=1) " & _
"((tblPupilIncidentLink.IncidentID)=" Me.txtPupilID

DoCmd.RunSQL strSQL

Linda

Jan 10 '06 #2
Linda Burnside wrote:
Try this:

Dim strSQL

strSQL = "DELETE tblPupilIncidentLink.PupilID " & _
" FROM tblPupilIncidentLink " & _
"WHERE (((tblPupilIncidentLink.PupilID)=1) " & _
"((tblPupilIncidentLink.IncidentID)=" Me.txtPupilID

DoCmd.RunSQL strSQL

Linda


Don't think that will work as Me.txtPupilID goes where the 1 is, and I need
to compare the IncidentID with that of the current record, i.e
[forms]![frmIncidentsListBox_version].[IncidentID].
Jan 10 '06 #3
Sorry ... I misunderstood.

In that case, try something like:
strSQL = "DELETE tblPupilIncidentLink.PupilID " & _
" FROM tblPupilIncidentLink " & _
"WHERE (((tblPupilIncidentLink.PupilID)=" & Me.txtPupilID & ") AND " & _
"((tblPupilIncidentLink.IncidentID)=" &
[forms]![frmIncidentsListBox_version].[IncidentID]

If the IncentID is contained in a subform, you may want use
Me![frmIncidentsListBox_version].Form![IncidentID] (reference the control as
part of a subform) instead of
[forms]![frmIncidentsListBox_version].[IncidentID]

Linda

"Deano" <de***@mailinator.com> wrote in message
news:43***********************@ptn-nntp-reader04.plus.net... Linda Burnside wrote:
Try this:

Dim strSQL

strSQL = "DELETE tblPupilIncidentLink.PupilID " & _
" FROM tblPupilIncidentLink " & _
"WHERE (((tblPupilIncidentLink.PupilID)=1) " & _
"((tblPupilIncidentLink.IncidentID)=" Me.txtPupilID

DoCmd.RunSQL strSQL

Linda


Don't think that will work as Me.txtPupilID goes where the 1 is, and I
need
to compare the IncidentID with that of the current record, i.e
[forms]![frmIncidentsListBox_version].[IncidentID].

Jan 10 '06 #4
Linda Burnside wrote:
Sorry ... I misunderstood.

In that case, try something like:
strSQL = "DELETE tblPupilIncidentLink.PupilID " & _
" FROM tblPupilIncidentLink " & _
"WHERE (((tblPupilIncidentLink.PupilID)=" & Me.txtPupilID & ") AND
" & _ "((tblPupilIncidentLink.IncidentID)=" &
[forms]![frmIncidentsListBox_version].[IncidentID]


If the IncentID is contained in a subform, you may want use
Me![frmIncidentsListBox_version].Form![IncidentID] (reference the
control as part of a subform) instead of
[forms]![frmIncidentsListBox_version].[IncidentID]


Thanks Linda, I tweaked that slightly to give me this and it worked;

strSQL = "DELETE tblPupilIncidentLink.*, tblPupilIncidentLink.PupilID,
tblPupilIncidentLink.IncidentID" & " FROM tblPupilIncidentLink " & "WHERE
(((tblPupilIncidentLink.PupilID)=" & Me.txtPupilID & ") AND " &
"((tblPupilIncidentLink.IncidentID)=" &
[Forms]![frmIncidentsListBox_version].[IncidentID] & "));"
Jan 10 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Brent | last post by:
I have just installed Office 2003 and Visual Studio Tools for Office 2003, including the Developer Extensions for Access. I kept my Access 2000/MOD installation intact (I hope), installed Access...
1
by: bonehead | last post by:
Okay, I see where the /nostartup switch turns off that big "Getting Started" babysitter, but I'd also like to turn off that combo box in the top right that says "Type a question for help". At some...
0
by: Tim Marshall | last post by:
Over the years since the introduction of "the monolithic save" in A2K, I've seen much discussion on it. But I'm not sure exactly what is happening in A2K3. When I save in the Access window, I...
6
by: Tim Marshall | last post by:
Here's the situation. A form, frmSetUp, with a subform control called subExplain with a source object form frmSetUpSubDefineSides. The source object is a bound form, displaying a few records, no...
19
by: David W. Fenton | last post by:
I'm setting up a project for a client on a new Windows Terminal Server. The application is currently in A2K, but the sysadmin does not want to install that, he wants to install A2K3, because Office...
3
by: Randy Harris | last post by:
Am I the only one that finds the help in Access 2003 extremely clumsy to use relative to the help in earlier versions? You can't undock that stupid task pane (it should be docked to the help...
13
by: Arno R | last post by:
Hi all, I am deploying an A2k app to users with different versions of Access. Using Access 2000 the relinking on startup (on deploying a new frontend or when backend has changed) is very fast....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.