473,395 Members | 1,530 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,395 software developers and data experts.

stored procedure recordsource - new record causes problems

Hi,

I have a stored procedure as a recordsource for a form, taking a
parameter from another form, it displays records that are already
present without any problems. I had to add a resync command to allow
edits, but it works ok for now.

The problem is when creating new records. If I open the form with
datamode acFormAdd, I get the blank record fine, I can populate the
fields ok. but when I come to close the record, I get the error
"line1:incorrect syntax near '.'". To which line1 is this referring to?

If I close the record, I get the usual 'you can't save at this time',
but it still creates the record. If I jump 'away' from the fields in
that particular form and back again, I can close the form without the
second error (notably, the (autonumber) field becomes populated when I
do this.. although as I say it works anyway even if I do close straight
away).

Any tips? I'm not sure if I'm going about this the right way...

Cheers,
Chris
Nov 13 '05 #1
6 3643
Are you sure that you are using stored procedure and not in-line function ?
I had a similar problem whith in-line function. When I changed it to stored
procedure everything worked fine...
"Not Me" <no*****@da.com.hk.org> je napisao u poruci interesnoj
grupi:d1**********@ucsnew1.ncl.ac.uk...
Hi,

I have a stored procedure as a recordsource for a form, taking a parameter
from another form, it displays records that are already present without
any problems. I had to add a resync command to allow edits, but it works
ok for now.

The problem is when creating new records. If I open the form with
datamode acFormAdd, I get the blank record fine, I can populate the fields
ok. but when I come to close the record, I get the error "line1:incorrect
syntax near '.'". To which line1 is this referring to?

If I close the record, I get the usual 'you can't save at this time', but
it still creates the record. If I jump 'away' from the fields in that
particular form and back again, I can close the form without the second
error (notably, the (autonumber) field becomes populated when I do this..
although as I say it works anyway even if I do close straight away).

Any tips? I'm not sure if I'm going about this the right way...

Cheers,
Chris

Nov 13 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The error refers to an error in the stored procedure (SP). Something is
wrong right before a period in line 1 of the SP.

I was under the impression that SPs were read only; therefore, you can't
add/edit!? I must be wrong.

When the "autonumber" field populates it is 'cuz the record was saved.
In SQL'r an Identity number (same as AutoNumber) isn't created until the
record is saved. In Access the AutoNumber is created when you start to
enter data into the form. If you Escape & Undo the data entry the
AutoNumber disappears.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQji8d4echKqOuFEgEQI0pQCfTsnAHfc0ampePDRsNRgp1W ETqegAoKrA
/q63bBrtR5t/4Wgwmr/wiIdV
=Jo+U
-----END PGP SIGNATURE-----
Not Me wrote:
Hi,

I have a stored procedure as a recordsource for a form, taking a
parameter from another form, it displays records that are already
present without any problems. I had to add a resync command to allow
edits, but it works ok for now.

The problem is when creating new records. If I open the form with
datamode acFormAdd, I get the blank record fine, I can populate the
fields ok. but when I come to close the record, I get the error
"line1:incorrect syntax near '.'". To which line1 is this referring to?

If I close the record, I get the usual 'you can't save at this time',
but it still creates the record. If I jump 'away' from the fields in
that particular form and back again, I can close the form without the
second error (notably, the (autonumber) field becomes populated when I
do this.. although as I say it works anyway even if I do close straight
away).

Any tips? I'm not sure if I'm going about this the right way...

Nov 13 '05 #3
Zlatko Matic wrote:
Are you sure that you are using stored procedure and not in-line function ?
I had a similar problem whith in-line function. When I changed it to stored
procedure everything worked fine...


hmm, nah it's definately a stored procedure! Ta anyway.

Cheers,
Chris
Nov 13 '05 #4
MGFoster wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The error refers to an error in the stored procedure (SP). Something is
wrong right before a period in line 1 of the SP.
Here's the SP, it's simple enough?

CREATE PROCEDURE spEventBooking
(
@eventID int = null
)
AS

SELECT EventsRecord.*, Events.Name, Events.TypeOfEvent,
Venue.VenueName, Users.Name 'EventContact'
FROM
EventsRecord INNER JOIN Events ON EventsRecord.Event = Events.EventsRef
INNER JOIN Venue ON Events.Venue = Venue.VenueID
LEFT OUTER JOIN Users ON Events.Contact = Users.UniqueUserID
WHERE eventsrecord.uniqueid = @eventid
GO

uniquetable is "eventsrecord", resync command is "spEventBooking
[me].[uniqueid]" (from the form)
I was under the impression that SPs were read only; therefore, you can't
add/edit!? I must be wrong.
Yup, I think that's what you need the uniquetable/resync properties, so
it knows what's being used, and can create update queries itself based
on that info.
When the "autonumber" field populates it is 'cuz the record was saved.
In SQL'r an Identity number (same as AutoNumber) isn't created until the
record is saved. In Access the AutoNumber is created when you start to
enter data into the form. If you Escape & Undo the data entry the
AutoNumber disappears.


Could it be something to do with the resync command? It's asking for the
autonumber back, but maybe asking too early?

Cheers,
Chris
Nov 13 '05 #5
Not Me wrote:
Could it be something to do with the resync command? It's asking for the
autonumber back, but maybe asking too early?


In addition to this, I tried removing the resync command. The error I
get is: "Key value for this row was changed or deleted at the data
store, the local row is deleted"

Does that shed any light on the problem?

Chris
Nov 13 '05 #6
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The SELECT clause has an extra column w/o a preceding comma:

SELECT EventsRecord.*, Events.Name, Events.TypeOfEvent,
Venue.VenueName, Users.Name 'EventContact'

If you want Users.Name to have an alias as EventContact, you have to
delimit the alias w/ square brackets or double quotes (SQL standard).
Throw in an "AS" to remove any doubt. E.g.:

Users.Name As "EventContact"

I avoid ADO as much as possible, 'cuz I can get DAO to do it w/ less
work (and I'm stuck on it ;-) ).

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQjpPjIechKqOuFEgEQJEEQCfcGahxpZ155XWFVH9m+LT8g Lr+ggAoMm0
Y4KRjy4L6ljr2YKkJXz1WUHS
=t42Q
-----END PGP SIGNATURE-----

Not Me wrote:
MGFoster wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The error refers to an error in the stored procedure (SP). Something is
wrong right before a period in line 1 of the SP.

Here's the SP, it's simple enough?

CREATE PROCEDURE spEventBooking
(
@eventID int = null
)
AS

SELECT EventsRecord.*, Events.Name, Events.TypeOfEvent,
Venue.VenueName, Users.Name 'EventContact'
FROM
EventsRecord INNER JOIN Events ON EventsRecord.Event = Events.EventsRef
INNER JOIN Venue ON Events.Venue = Venue.VenueID
LEFT OUTER JOIN Users ON Events.Contact = Users.UniqueUserID
WHERE eventsrecord.uniqueid = @eventid
GO

uniquetable is "eventsrecord", resync command is "spEventBooking
[me].[uniqueid]" (from the form)
I was under the impression that SPs were read only; therefore, you can't
add/edit!? I must be wrong.

Yup, I think that's what you need the uniquetable/resync properties, so
it knows what's being used, and can create update queries itself based
on that info.
When the "autonumber" field populates it is 'cuz the record was saved.
In SQL'r an Identity number (same as AutoNumber) isn't created until the
record is saved. In Access the AutoNumber is created when you start to
enter data into the form. If you Escape & Undo the data entry the
AutoNumber disappears.

Could it be something to do with the resync command? It's asking for the
autonumber back, but maybe asking too early?

Cheers,
Chris

Nov 13 '05 #7

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

Similar topics

6
by: Shaun Stuart | last post by:
I've got a webpage that calls some stored procedures with input variables. The procedures return recordsets and also some output variables. We're trying to get the values of the output variables....
1
by: Lauren Quantrell | last post by:
I have a stored procedure named mySP that looks basically like this: Select Field1, Field2 From tblMyTable Where Field 3 = 'xyz' What I do is to populate an Access form: DoCmd.Openform...
12
by: serge | last post by:
I have an SP that is big, huge, 700-800 lines. I am not an expert but I need to figure out every possible way that I can improve the performance speed of this SP. In the next couple of weeks I...
1
by: Lauren Quantrell | last post by:
I have read the newsgroups and see this is a common issue but I saw no resolution for it: I have an Access2K frotn end and SQL Server 2K backend. In access, I create a temp table using code in a...
8
by: Mark Flippin | last post by:
This is for a reporting problem using: Access 2000 SQL Server 2000 Both at SP3 I've a stored procedure in SQL Server 2000 which builds a result set from a disparate set of tables, utilizing...
1
by: Sreeneet | last post by:
Hi all, I want to call a stored procedure which is written in SQL Server from an ms-access query. It is having some parameters also and the stored procedure will return some records. Is there...
2
by: dbuchanan | last post by:
Hello, My insert results in two records - or better stated the temporary record (with the temporary ID value of -1) stays as the stored procedure returns the new record with its data base...
9
by: fniles | last post by:
I am using VB.NET 2003 and SQL2000 database. I have a stored procedure called "INSERT_INTO_MYTABLE" that accepts 1 parameter (varchar(10)) and returns the identity column value from that table....
17
by: kkk1979 | last post by:
I have been using access as front end and SQL as Back end. I need help in generating an access report, by using a stored procedure with input parameters as record source. I tried the following...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.