473,587 Members | 2,581 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with writing to a linked table

I have a linked table (two primary keys: one coming from Me.txtRMA#
and the other is an Autonumber) that I am writing to from an unbound
form. Please review my code and tell me what is wrong with it. I don't
get any errors and no data is written to the table. It doesn't do
anything. Thanks for the help

Private Sub cmdSubmit_Click ()
On Error GoTo Submit_Click_Er r
Dim rstEvalForm As Recordset

'Set the variable by opening the Table: tblRMAEval.
Set rstEvalForm = CurrentDb.OpenR ecordset("tblRM AEval", dbOpenDynaset)
With rstEvalForm
'Add a new record to the end of the Recordset Object.
.AddNew
![idsRMA#] = Me.[txtRMA#]
![dtmDate] = Me.cboEvalDate
![chrTech] = Me.cboTechName
![blnLooseHardwar eCheck] = Me.chkHardware
![blnWiringConnec tionsCheck] = Me.chkWiring
![blnOpticsCheck] = Me.chkOptical
![chrVisualCommen ts] = Me.txtVisualCom ments
![blnShortsCheck] = Me.chkShorts
![chrShotsCount] = Me.txtShots
![intInputE] = Me.txtInputE
![intDoubleE] = Me.txtDoubleE
![intPFNE] = Me.txtPFNE
![intSCRE] = Me.txtSCRE
![chrPowerComment s] = Me.txtPowerComm ents
![blnLaserFire] = Me.chkFired
![int10ShotAvg] = Me.txt10Shot
![intPW] = Me.txtPW
![blnATREnergy] = Me.chkATR
![blnGUITest] = Me.chkGUI
![chrLaserComment s] = Me.txtLaserComm ents
![intFirstTargetA ctual] = Me.txtFirstBIT
![intLastTargetAc tual] = Me.txtLastBIT
.Update
End With
'Close the recordset and set it to nothing.
rstEvalForm.Clo se
Set rstEvalForm = Nothing

cmdSubmit_Click _Exit:
ExitSub
cmdSubmit_Click _Err:
MsgBox Err.Description
Resume cmdSubmit_Click _Err
End Sub

Thanks in advance.

Troy Lee
Jul 30 '08 #1
3 1282
<tr******@comca st.netwrote in message
news:31******** *************** ***********@a70 g2000hsh.google groups.com...
![idsRMA#] = Me.[txtRMA#]
![idsRMA#] = Me.txtRMA#

Maybe? Not sure that using # in a field name is a good thing.

Regards,
Keith.
www.keithwilby.com

Jul 30 '08 #2
On Jul 30, 7:13*am, troy_...@comcas t.net wrote:
I have a linked table (two primary keys: one coming from Me.txtRMA#
and the other is an Autonumber) that I am writing to from an unbound
form. Please review my code and tell me what is wrong with it. I don't
get any errors and no data is written to the table. It doesn't do
anything. Thanks for the help

Private Sub cmdSubmit_Click ()
On Error GoTo Submit_Click_Er r
Dim rstEvalForm As Recordset

'Set the variable by opening the Table: tblRMAEval.
Set rstEvalForm = CurrentDb.OpenR ecordset("tblRM AEval", dbOpenDynaset)
* * With rstEvalForm
* * * * 'Add a new record to the end of the Recordset Object.
* * * * .AddNew
* * * * ![idsRMA#] = Me.[txtRMA#]
* * * * ![dtmDate] = Me.cboEvalDate
* * * * ![chrTech] = Me.cboTechName
* * * * ![blnLooseHardwar eCheck] = Me.chkHardware
* * * * ![blnWiringConnec tionsCheck] = Me.chkWiring
* * * * ![blnOpticsCheck] = Me.chkOptical
* * * * ![chrVisualCommen ts] = Me.txtVisualCom ments
* * * * ![blnShortsCheck] = Me.chkShorts
* * * * ![chrShotsCount] = Me.txtShots
* * * * ![intInputE] = Me.txtInputE
* * * * ![intDoubleE] = Me.txtDoubleE
* * * * ![intPFNE] = Me.txtPFNE
* * * * ![intSCRE] = Me.txtSCRE
* * * * ![chrPowerComment s] = Me.txtPowerComm ents
* * * * ![blnLaserFire] = Me.chkFired
* * * * ![int10ShotAvg] = Me.txt10Shot
* * * * ![intPW] = Me.txtPW
* * * * ![blnATREnergy] = Me.chkATR
* * * * ![blnGUITest] = Me.chkGUI
* * * * ![chrLaserComment s] = Me.txtLaserComm ents
* * * * ![intFirstTargetA ctual] = Me.txtFirstBIT
* * * * ![intLastTargetAc tual] = Me.txtLastBIT
* * * * .Update
* * End With
'Close the recordset and set it to nothing.
rstEvalForm.Clo se
Set rstEvalForm = Nothing

cmdSubmit_Click _Exit:
* * ExitSub
cmdSubmit_Click _Err:
* * MsgBox Err.Description
* * Resume cmdSubmit_Click _Err
End Sub

Thanks in advance.

Troy Lee
I know this code isn't exactly as you are running it because you'd get
a compile error saying "label not defined". Your 'On Error' statement
points to a non-existent line label. There is no "Submit_Click_E rr"
line, but there is a "cmdSubmit_Clic k_Err" line. After that, your
Resume will send you into an infinite loop (you probably meant to say
"resume cmdSubmit_Click _Exit"

Bruce
Jul 30 '08 #3
On Jul 30, 1:07 pm, Bruce <deluxeinformat ...@gmail.comwr ote:
On Jul 30, 7:13 am, troy_...@comcas t.net wrote:
I have a linked table (two primary keys: one coming from Me.txtRMA#
and the other is an Autonumber) that I am writing to from an unbound
form. Please review my code and tell me what is wrong with it. I don't
get any errors and no data is written to the table. It doesn't do
anything. Thanks for the help
Private Sub cmdSubmit_Click ()
On Error GoTo Submit_Click_Er r
Dim rstEvalForm As Recordset
'Set the variable by opening the Table: tblRMAEval.
Set rstEvalForm = CurrentDb.OpenR ecordset("tblRM AEval", dbOpenDynaset)
With rstEvalForm
'Add a new record to the end of the Recordset Object.
.AddNew
![idsRMA#] = Me.[txtRMA#]
![dtmDate] = Me.cboEvalDate
![chrTech] = Me.cboTechName
![blnLooseHardwar eCheck] = Me.chkHardware
![blnWiringConnec tionsCheck] = Me.chkWiring
![blnOpticsCheck] = Me.chkOptical
![chrVisualCommen ts] = Me.txtVisualCom ments
![blnShortsCheck] = Me.chkShorts
![chrShotsCount] = Me.txtShots
![intInputE] = Me.txtInputE
![intDoubleE] = Me.txtDoubleE
![intPFNE] = Me.txtPFNE
![intSCRE] = Me.txtSCRE
![chrPowerComment s] = Me.txtPowerComm ents
![blnLaserFire] = Me.chkFired
![int10ShotAvg] = Me.txt10Shot
![intPW] = Me.txtPW
![blnATREnergy] = Me.chkATR
![blnGUITest] = Me.chkGUI
![chrLaserComment s] = Me.txtLaserComm ents
![intFirstTargetA ctual] = Me.txtFirstBIT
![intLastTargetAc tual] = Me.txtLastBIT
.Update
End With
'Close the recordset and set it to nothing.
rstEvalForm.Clo se
Set rstEvalForm = Nothing
cmdSubmit_Click _Exit:
ExitSub
cmdSubmit_Click _Err:
MsgBox Err.Description
Resume cmdSubmit_Click _Err
End Sub
Thanks in advance.
Troy Lee

I know this code isn't exactly as you are running it because you'd get
a compile error saying "label not defined". Your 'On Error' statement
points to a non-existent line label. There is no "Submit_Click_E rr"
line, but there is a "cmdSubmit_Clic k_Err" line. After that, your
Resume will send you into an infinite loop (you probably meant to say
"resume cmdSubmit_Click _Exit"

Bruce
Thank you. Good catch. I will give it a try.

Troy
Jul 31 '08 #4

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

Similar topics

5
1966
by: Steve | last post by:
I'm trying to do a multi table query that displays all the info I need in one array, and I'm having problems figuring out how to do it. The two tables are product and vendor. A vendor can be a manufacturer, distributor, or both. This is indicated via the manufacturer_YN and distributor_YN fields in the vendor table, and vendor_id is an auto_number field. In the product table, there is a manufacturer_id and a distributor_id field, and...
6
1779
by: Christopher Benson-Manica | last post by:
I have some markup like the following: <form> <table> <script> <!-- Write the table markup //--> </script> </table> <form>
2
1623
by: Wayne Wengert | last post by:
This is my first attempt to re-write an old VB6 application that exported a CSV file to a .NET application that exports an XML file with the equivelent data. I have limited understanding of OO programming concepts (am trying to learn) and XML serialization is all new ground for me. Anyway, here is what I am trying to accomplish: Goal ---- We sponsor competitions in ehich various teams compete. An "event" is made up of a set of "shows"....
2
17741
by: Amanda | last post by:
From a guy in Microsoft newsgroups: | In *comp.databases.ibm-db2* there are always IBM guys | from the Toronto labs on line.Post with the | -for the love of god please help- | line and I'm sure you'll get their attention. | Their usually very good:) So here's my transplanted post ==========================================
9
4339
by: Dom Boyce | last post by:
Hi First up, I am using MS Access 2002. I have a database which records analyst rating changes for a list of companies on a daily basis. Unfortunately, the database has been set up (by my predecessor, I hasten to add) so that each day it creates a copy of the record for each company, changes the date to today's date, and prompts the user for any changes of ratings on that day. The resulting data table grows by approx 600 records per...
20
2352
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File (Employees), and the other is an Address File (Addresses) linked by SSN. I've set Addresses as a Lookup Table - If the user starts typing in the SSN it should pull up the Employees records. I'm getting stuck in the Data Entry form. When I type in...
4
2269
by: Laura | last post by:
Here's the situation: I'm trying to use an update query to copy data from one row to another. Here is the situation: I have 5 companies that are linked to each other. I need to show all 5 companies on a form. 3 of the companies have common employees. I have a table that looks like this:
2
365
by: Joe Ahearn | last post by:
I am new to using Access, and hope that someone will be able to help with a problem I'm having with my database: I created a skills assessment test for my department at work. It has 124 separate forms, all linked to one table (one sign in form, and 123 questions). I have macros that close one form, and open the next one. It all works just fine, EXCEPT that the responses to each question are not populating in the same row of the table...
23
2779
by: mlcampeau | last post by:
Hey guys, I have been mulling over this problem for a few days and have yet to come up with a query that will give me the expected results. I am working on a database that stores employee information, and my boss has asked me to add a component that will keep track of job vacancies as well. I have 6 tables that are all linked: Table: Employee 1. ID; Text; PK 2. ... (the rest are irrelevant to the query) Table: EmplStatus (linked to...
0
7857
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,...
0
8352
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 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...
0
8222
tracyyun
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...
0
6632
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, 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...
0
5396
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();...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2367
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
1
1457
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1194
bsmnconsultancy
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...

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.