ADP front end, SQL Server backend.
On my main form, I need to pull up in a select query in values from a record I am in the process of adding, before SQL Server actually saves the record to give me the Primary Key ID, which is autoincrement. I've tried docmd.runcomman d accmdsaverecord , but it is giving me this:
Run-time error '7874':
Access can't find the object 'SELECT ((0)) AS Column1, ((0)) AS Column2,((0)) AS Column3,((0)) AS Column4,((0)) AS Column5,((0)) AS Column6,((0)) AS Column7.'
I'm not sure where this select statement is coming from, but I get this error in multiple places where I'm trying to save the record in VBA.
What's going on? Is there another way to save a record in VBA other than this?
Help! I'm running out of steam and have a deadline.
4 13085 Minion 108
Recognized Expert New Member
I'm not entirely sure what you are trying to do here. Are you using a form to enter the data inot the record, and if so why not just call the values from the form rather than the record itself?
Pleae elaberate on the set up of the project and what it is you're trying to accomplish so that we might better help you.
- Minion -
ADP front end, SQL Server backend.
On my main form, I need to pull up in a select query in values from a record I am in the process of adding, before SQL Server actually saves the record to give me the Primary Key ID, which is autoincrement. I've tried docmd.runcomman d accmdsaverecord , but it is giving me this:
Run-time error '7874':
Access can't find the object 'SELECT ((0)) AS Column1, ((0)) AS Column2,((0)) AS Column3,((0)) AS Column4,((0)) AS Column5,((0)) AS Column6,((0)) AS Column7.'
I'm not sure where this select statement is coming from, but I get this error in multiple places where I'm trying to save the record in VBA.
What's going on? Is there another way to save a record in VBA other than this?
Help! I'm running out of steam and have a deadline.
I'm not entirely sure what you are trying to do here. Are you using a form to enter the data inot the record, and if so why not just call the values from the form rather than the record itself?
Pleae elaberate on the set up of the project and what it is you're trying to accomplish so that we might better help you.
- Minion -
Hi RAG2007,
Neither am I! Rag if you don't know where that SQL is coming from there is not much chance of others knowing either and contributing something meaningful unless there is more detail regarding the potential source code causing it?
(Minion I love your signature by the way hahaha)
Jim
I'm creating a Project ID number based on the information of the currently entered project. That ID is based off of a code corresponding to the client company we work with. I have to pull up related that code from a separate table not in the recordsource. I was able to do this when Access was the backend, because access saves the record as soon as info is entered; SQL Server doesn't seem to do that, so I need a way to save the record to then use that record's info to pull up other data. When I used accmdSaveRecord , I got the error, including that really wierd select statement which I have no idea where it comes from.
Does that clarify? I could add more code to illustrate...
I actually rebuilt the entire form and reworked the way I was doing it, so the workaround is OK. But I'm worried that this issue may creep up again. I figured someone had probably dealt with something like this before.
Hi RAG2007,
Neither am I! Rag if you don't know where that SQL is coming from there is not much chance of others knowing either and contributing something meaningful unless there is more detail regarding the potential source code causing it?
(Minion I love your signature by the way hahaha)
Jim
I'm creating a Project ID number based on the information of the currently entered project. That ID is based off of a code corresponding to the client company we work with. I have to pull up related that code from a separate table not in the recordsource. I was able to do this when Access was the backend, because access saves the record as soon as info is entered; SQL Server doesn't seem to do that, so I need a way to save the record to then use that record's info to pull up other data. When I used accmdSaveRecord , I got the error, including that really wierd select statement which I have no idea where it comes from.
Does that clarify? I could add more code to illustrate...
I actually rebuilt the entire form and reworked the way I was doing it, so the workaround is OK. But I'm worried that this issue may creep up again. I figured someone had probably dealt with something like this before.
Access doesn't save a record as soon as you enter something unless you tell it to in code, it saves on moving to another record. The 'pencil' tentative marker is an indicator of that. SQL server visually reacts in the same way as Access saving records in an ADP if things are behaving correctly ( ie: If you move to the next record or again, if you tell it to save via code in the forms properties or some other control event.)
I use ADP's all the time and for me visually there is no appreciable difference between the response in and MDB and an ADP ( again if tihngs are behaving themselves) besides having to be aware that records are on the server not in the client access application and thus an element of resynchronisati on might be required to avail server changes to the client.
If the form has a tentative un-saved record state then the forms DIRTY property is true and switching that to FALSE in code serves to save the record.
IF Me.Dirty=True Then Me.Dirty =False
Depending on the setup of your forms recordsource you may need to look at the RESYNCH property setting of the form in help? which ensures that record edits on the server side are reflected in the form. Have you used that yet? if not have a look at it it might need resynching
An example of a typical resynch command in the on current event / after insert event of the form might be something like this
Me.ResyncComman d = "Select * from dbo.qryMyView where RecordID=" & Me!RecordID
where dbo.qryMyView is your forms recordsource and you are resynching to ensure that any changes are reflected in the form
Regards
Jim :)
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: dixie |
last post by:
I know I've asked this before, but the answer elludes me and the message has
long since disappeared from my newsgroup messages. How do you save a record
using vba from a button or as part of an after update event in a form?
dixie
|
by: icedgar |
last post by:
am using the following script in the BeforeUpdate area of a main form.
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
strMsg = "Do you wish to save your changes?"
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes
Then
'do nothing
Else
|
by: WJA |
last post by:
I'm probably missing something here but I can't understand the
following. When 2 users try to save a record with the same primary key
(a number field), the first record saves as expected, but the second
does not produce an error. The "Save" button uses "Docmd.Save" to save
the record. If I insert "Me.Dirty = False" before "Docmd.Save" an
error is produced. Why doesn't "Docmd.Save" produce an error but
instead silently fails to save the...
|
by: Br |
last post by:
First issue:
When using ADPs you no longer have the ability to issue a me.refresh to
save the current record on a form (the me.refresh does a requery in an
ADP).
We usually do this before calling up another form or report that uses
some of the same data.
We came up with a work around that saves the current record's ID, does a
|
by: sara |
last post by:
I have a simple app, and I'm trying to add Orders.
I have tblOrders and tblOrderDetails.
First, the user selects the customer, then "orders", "new Order"
The frmNewOrder simply assures the user she is on the right customer
and sets up an orderKey and orderNumber.
The user enters "Drop Off date", to make the form dirty, and to have
| |
by: Ken Mylar |
last post by:
I have a dilema here that I'm hoping some one can help me out with.
On my forms I have some basic New, Edit, Save, Delete, Undo buttons on
them. When first opened all controls on the form are not enabled. When
you hit one of the buttons certain controls enable and some don't
depending on the function. My dilema is with the New button and in turn
the Save button.
I would rather the user click the "New" button to add a record instead
of...
|
by: David |
last post by:
Hi,
I have a continuous form with 'x' amount of records.
1 field on each record is a number, of which I have a field at the top
of the form which just shows the running sum.
If I enter a new record, after I loose focus of the number field, I
perform a save record and then test the data with a calculation, but
the problem I have is that the sum field always updates a second later
than the save and calculation is performed, even though...
|
by: voroojak |
last post by:
Hi
How can i put save record and next record in one button.
in my save record i put the calculation of the text boxes. i have a total field that the sum of the other field is in there and it wil be filled when i push the save button. and the sum will go and save in a table. but now the new requirment is that i put save record and next record in one button to be easier for the user.
i was using the next record seperately.
thanks for the help.
|
by: Ian |
last post by:
I am trying to save the current record on a form before opening a
report, doesn’t sound to hard does it? The code on a buttons on click
event goes like this:
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'First save record
I used this for many years with problems using Access 97, when the
database is upgraded to Access 2000 or later I occasionally get an error
message saying “Save Command is not available now”.
|
by: Neil |
last post by:
Was working in A2003 and noticed that the Save Record item on the Records
menu was not available when the record was not dirty. In A2000, Save Record
was always available. (This is a problem for me because I have Docmd.Runcmd
acCmdSaveRecord code all over the place, which never gave an error before.
But now it was giving an error when the Save Record menu command wasn't
available.)
So I went back to A2000 and confirmed that the Save...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |