473,396 Members | 2,018 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.

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_Err
Dim rstEvalForm As Recordset

'Set the variable by opening the Table: tblRMAEval.
Set rstEvalForm = CurrentDb.OpenRecordset("tblRMAEval", dbOpenDynaset)
With rstEvalForm
'Add a new record to the end of the Recordset Object.
.AddNew
![idsRMA#] = Me.[txtRMA#]
![dtmDate] = Me.cboEvalDate
![chrTech] = Me.cboTechName
![blnLooseHardwareCheck] = Me.chkHardware
![blnWiringConnectionsCheck] = Me.chkWiring
![blnOpticsCheck] = Me.chkOptical
![chrVisualComments] = Me.txtVisualComments
![blnShortsCheck] = Me.chkShorts
![chrShotsCount] = Me.txtShots
![intInputE] = Me.txtInputE
![intDoubleE] = Me.txtDoubleE
![intPFNE] = Me.txtPFNE
![intSCRE] = Me.txtSCRE
![chrPowerComments] = Me.txtPowerComments
![blnLaserFire] = Me.chkFired
![int10ShotAvg] = Me.txt10Shot
![intPW] = Me.txtPW
![blnATREnergy] = Me.chkATR
![blnGUITest] = Me.chkGUI
![chrLaserComments] = Me.txtLaserComments
![intFirstTargetActual] = Me.txtFirstBIT
![intLastTargetActual] = Me.txtLastBIT
.Update
End With
'Close the recordset and set it to nothing.
rstEvalForm.Close
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 1272
<tr******@comcast.netwrote in message
news:31**********************************@a70g2000 hsh.googlegroups.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_...@comcast.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_Err
Dim rstEvalForm As Recordset

'Set the variable by opening the Table: tblRMAEval.
Set rstEvalForm = CurrentDb.OpenRecordset("tblRMAEval", dbOpenDynaset)
* * With rstEvalForm
* * * * 'Add a new record to the end of the Recordset Object.
* * * * .AddNew
* * * * ![idsRMA#] = Me.[txtRMA#]
* * * * ![dtmDate] = Me.cboEvalDate
* * * * ![chrTech] = Me.cboTechName
* * * * ![blnLooseHardwareCheck] = Me.chkHardware
* * * * ![blnWiringConnectionsCheck] = Me.chkWiring
* * * * ![blnOpticsCheck] = Me.chkOptical
* * * * ![chrVisualComments] = Me.txtVisualComments
* * * * ![blnShortsCheck] = Me.chkShorts
* * * * ![chrShotsCount] = Me.txtShots
* * * * ![intInputE] = Me.txtInputE
* * * * ![intDoubleE] = Me.txtDoubleE
* * * * ![intPFNE] = Me.txtPFNE
* * * * ![intSCRE] = Me.txtSCRE
* * * * ![chrPowerComments] = Me.txtPowerComments
* * * * ![blnLaserFire] = Me.chkFired
* * * * ![int10ShotAvg] = Me.txt10Shot
* * * * ![intPW] = Me.txtPW
* * * * ![blnATREnergy] = Me.chkATR
* * * * ![blnGUITest] = Me.chkGUI
* * * * ![chrLaserComments] = Me.txtLaserComments
* * * * ![intFirstTargetActual] = Me.txtFirstBIT
* * * * ![intLastTargetActual] = Me.txtLastBIT
* * * * .Update
* * End With
'Close the recordset and set it to nothing.
rstEvalForm.Close
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_Err"
line, but there is a "cmdSubmit_Click_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.comwrote:
On Jul 30, 7:13 am, troy_...@comcast.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_Err
Dim rstEvalForm As Recordset
'Set the variable by opening the Table: tblRMAEval.
Set rstEvalForm = CurrentDb.OpenRecordset("tblRMAEval", dbOpenDynaset)
With rstEvalForm
'Add a new record to the end of the Recordset Object.
.AddNew
![idsRMA#] = Me.[txtRMA#]
![dtmDate] = Me.cboEvalDate
![chrTech] = Me.cboTechName
![blnLooseHardwareCheck] = Me.chkHardware
![blnWiringConnectionsCheck] = Me.chkWiring
![blnOpticsCheck] = Me.chkOptical
![chrVisualComments] = Me.txtVisualComments
![blnShortsCheck] = Me.chkShorts
![chrShotsCount] = Me.txtShots
![intInputE] = Me.txtInputE
![intDoubleE] = Me.txtDoubleE
![intPFNE] = Me.txtPFNE
![intSCRE] = Me.txtSCRE
![chrPowerComments] = Me.txtPowerComments
![blnLaserFire] = Me.chkFired
![int10ShotAvg] = Me.txt10Shot
![intPW] = Me.txtPW
![blnATREnergy] = Me.chkATR
![blnGUITest] = Me.chkGUI
![chrLaserComments] = Me.txtLaserComments
![intFirstTargetActual] = Me.txtFirstBIT
![intLastTargetActual] = Me.txtLastBIT
.Update
End With
'Close the recordset and set it to nothing.
rstEvalForm.Close
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_Err"
line, but there is a "cmdSubmit_Click_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
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...
6
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
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...
2
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...
9
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...
20
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...
4
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...
2
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...
23
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...
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?
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
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
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...
0
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...
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,...
0
isladogs
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...

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.