Slick SWB Toolbar screwing up my insert into command

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

I downloaded the Slick Switchboard from the internet and it's screwing up my
INSERT INTO command button. I want to keep the switchboard but it's having
issues because it doesn't see the "documents" form. Here is my code:

DoCmd.RunSQL "INSERT INTO tblDMP (DataItemName, Type, Format_Tool,
StorageLocation, VersionControl, ChangeControl, AccessPermissions,
BackupFrequency, SecurityLevel, CreationFrequency, DeliveryMethod) VALUES ('"
& Me.Title & "', '" & Me.InternalDeliverable & "', '" & Me.Format & "', '" &
[Forms]![SDISwitchboardInFormReports]![Documents]![Location1]![Directory] &
"', '" & Me.VersionControlled & "', '" & Me.ChangeControlled & "', '" &
Me.AccessPermissions & "', '" & Me.BackupFrequency & "', '" &
Me.SecurityLevel & "', '" & Me.CreationFrequency & "', '" & Me.DeliveryMethod
& "')"
 
Your syntax looks incorrect.

To what is
[Forms]![SDISwitchboardInFormReports]![Documents]![Location1]![Directory]
supposed to be referring? If Documents is a subform on from
SDISwitchboardInFormReports, you need to include .Form after it, but I don't
understand the [Location1]![Directory].

See whether http://www.mvps.org/access/forms/frm0031.htm helps you.
 
Douglas,
There is a main form called Documents. A sub form called "Location1" and the
fieldname in Location1 that I want called is Directory. This switchboard is
causing the problems and I cannot do the INSERT INTO unless I open the
Documents form by itself (without the switchboard).

Ben

Douglas J. Steele said:
Your syntax looks incorrect.

To what is
[Forms]![SDISwitchboardInFormReports]![Documents]![Location1]![Directory]
supposed to be referring? If Documents is a subform on from
SDISwitchboardInFormReports, you need to include .Form after it, but I don't
understand the [Location1]![Directory].

See whether http://www.mvps.org/access/forms/frm0031.htm helps you.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ben said:
I downloaded the Slick Switchboard from the internet and it's screwing up
my
INSERT INTO command button. I want to keep the switchboard but it's having
issues because it doesn't see the "documents" form. Here is my code:

DoCmd.RunSQL "INSERT INTO tblDMP (DataItemName, Type, Format_Tool,
StorageLocation, VersionControl, ChangeControl, AccessPermissions,
BackupFrequency, SecurityLevel, CreationFrequency, DeliveryMethod) VALUES
('"
& Me.Title & "', '" & Me.InternalDeliverable & "', '" & Me.Format & "', '"
&
[Forms]![SDISwitchboardInFormReports]![Documents]![Location1]![Directory]
&
"', '" & Me.VersionControlled & "', '" & Me.ChangeControlled & "', '" &
Me.AccessPermissions & "', '" & Me.BackupFrequency & "', '" &
Me.SecurityLevel & "', '" & Me.CreationFrequency & "', '" &
Me.DeliveryMethod
& "')"
 
Ben said:
DoCmd.RunSQL

The problem with DoCmd.RunSQ is that it ignores any errors. Either
of the following will display any error messages received by the
query. If using DAO, use Currentdb.Execute strSQL,dbfailonerror..
For ADO use CurrentProject.Connection.Execute strCommand,
lngRecordsAffected, adCmdText You can then remove the
docmd.setwarnings lines.

If you're going to use docmd.setwarnings make very sure you put the
True statement in any error handling code as well. Otherwise weird
things may happen later on especially while you are working on the
app. For example you will no longer get the "Do you wish to save your
changes" message if you close an object. This may mean that unwanted
changes, deletions or additions will be saved to your MDB.

Also performance can be significantly different between the two
methods. One posting stated currentdb.execute took two seconds while
docmd.runsql took eight seconds. As always YMMV.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
I'm wondering whether Slick SWB is creating subforms out of your forms.

Is SDISwitchboardInFormReports a form that you can look at? If so, check
whether there's a subform control on it that contains your Documents form.

If so, you might need
[Forms]![SDISwitchboardInFormReports]![Documents].Form![Location1].Form![Directory]

Of course, it's possible that the name of the subform control may not be
Documents, in which case you'd need to substitute the name of the subform
control for Documents above. (For that matter, Location1 may not be the name
of the subform control on your Documents form!)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ben said:
Douglas,
There is a main form called Documents. A sub form called "Location1" and
the
fieldname in Location1 that I want called is Directory. This switchboard
is
causing the problems and I cannot do the INSERT INTO unless I open the
Documents form by itself (without the switchboard).

Ben

Douglas J. Steele said:
Your syntax looks incorrect.

To what is
[Forms]![SDISwitchboardInFormReports]![Documents]![Location1]![Directory]
supposed to be referring? If Documents is a subform on from
SDISwitchboardInFormReports, you need to include .Form after it, but I
don't
understand the [Location1]![Directory].

See whether http://www.mvps.org/access/forms/frm0031.htm helps you.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ben said:
I downloaded the Slick Switchboard from the internet and it's screwing
up
my
INSERT INTO command button. I want to keep the switchboard but it's
having
issues because it doesn't see the "documents" form. Here is my code:

DoCmd.RunSQL "INSERT INTO tblDMP (DataItemName, Type, Format_Tool,
StorageLocation, VersionControl, ChangeControl, AccessPermissions,
BackupFrequency, SecurityLevel, CreationFrequency, DeliveryMethod)
VALUES
('"
& Me.Title & "', '" & Me.InternalDeliverable & "', '" & Me.Format & "',
'"
&
[Forms]![SDISwitchboardInFormReports]![Documents]![Location1]![Directory]
&
"', '" & Me.VersionControlled & "', '" & Me.ChangeControlled & "', '" &
Me.AccessPermissions & "', '" & Me.BackupFrequency & "', '" &
Me.SecurityLevel & "', '" & Me.CreationFrequency & "', '" &
Me.DeliveryMethod
& "')"
 
Back
Top