473,398 Members | 2,393 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,398 software developers and data experts.

INSERT INTO locking table?

26
Greetings all,

I have a popup form that is mostly populated with information from a table based off a user's selection from the form the popup is initiated from. They select a record from a dropdown, which pulls the information displayed in the popup form.

In this popup form, the user then enters a quantity number and a few other details. When they click the "Add" button to run the sql statement and insert the details into a new table, I get an error that looks like
????? ' TableName ' ????????

I am using Access '97 on XP.

Here is my code for the "Add" on-click event:
Expand|Select|Wrap|Line Numbers
  1. Dim ShortPN As String
  2. Dim DueDteConv As Date
  3.  
  4. Dim mySQL As String
  5.  
  6.     If [OverrideDefaultNum] = "Yes" Then
  7.     ShortPN = [OverrideNum]
  8.     Else
  9.     ShortPN = [DefaultPartNum]
  10.     End If
  11.  
  12.     DueDteConv = Format([DueDte], "m/d/yyyy")
  13.  
  14.     mySQL = "INSERT INTO Queue 
  15.         (ShortPN, Qty, Setup, Machine1, Machine2, EntryDte, DueDte) " _
  16.     & "VALUES ('" & ShortPN & "'," & [Qty] & "," & [Setup] & ",'" & [Priority1]& "','" & [Priority2] & "',#" & Date & "#,#" & DueDteConv & "#);"
  17.  
  18.     DoCmd.RunSQL mySQL
  19.     DoCmd.Close
  20.  
The sql statement works if I run it without the form open using the output of my debug.print. After I get this error, if I open the "Queue" table, it appears to be locked as in no records can be inserted in table view. I have searched the forums and have been unable to find anything similar. Any information would be appreciated!
Dec 4 '07 #1
7 3323
FishVal
2,653 Expert 2GB
Greetings all,

I have a popup form that is mostly populated with information from a table based off a user's selection from the form the popup is initiated from. They select a record from a dropdown, which pulls the information displayed in the popup form.

In this popup form, the user then enters a quantity number and a few other details. When they click the "Add" button to run the sql statement and insert the details into a new table, I get an error that looks like
????? ' TableName ' ????????

I am using Access '97 on XP.

Here is my code for the "Add" on-click event:
Expand|Select|Wrap|Line Numbers
  1. Dim ShortPN As String
  2. Dim DueDteConv As Date
  3.  
  4. Dim mySQL As String
  5.  
  6.     If [OverrideDefaultNum] = "Yes" Then
  7.     ShortPN = [OverrideNum]
  8.     Else
  9.     ShortPN = [DefaultPartNum]
  10.     End If
  11.  
  12.     DueDteConv = Format([DueDte], "m/d/yyyy")
  13.  
  14.     mySQL = "INSERT INTO Queue 
  15.         (ShortPN, Qty, Setup, Machine1, Machine2, EntryDte, DueDte) " _
  16.     & "VALUES ('" & ShortPN & "'," & [Qty] & "," & [Setup] & ",'" & [Priority1]& "','" & [Priority2] & "',#" & Date & "#,#" & DueDteConv & "#);"
  17.  
  18.     DoCmd.RunSQL mySQL
  19.     DoCmd.Close
  20.  
The sql statement works if I run it without the form open using the output of my debug.print. After I get this error, if I open the "Queue" table, it appears to be locked as in no records can be inserted in table view. I have searched the forums and have been unable to find anything similar. Any information would be appreciated!
Hi, there.
  • Check RecordLocks property of the form
  • Check the Date output goes to your string in a proper m/d/y format.
    Copypasting the string into query designer is not the same as soon as smart query designer silently tries to adjust date value to fit m/d/y format.

Regards,
Fish
Dec 4 '07 #2
kjworm
26
Hi, there.
  • Check RecordLocks property of the form
  • Check the Date output goes to your string in a proper m/d/y format.
    Copypasting the string into query designer is not the same as soon as smart query designer silently tries to adjust date value to fit m/d/y format.

Regards,
Fish
Thanks for the response.

I checked the RecordLocks and they are set to No Locks.

I have tried inputting the date into my string textbox in various formats (i.e. 12-4-2007 and 12/4/07) and a MsgBox of my DueDteConv returns 12/4/2007. I'm not sure what else I can do to see the date format in the smart query designer...

As a side note, the reason I'm changing a string to a date is so that I can control the format consistently for all of the dates I'm using...

Any other thoughts? I intially had an autonumber field as the PK, but thought that may be a problem so I removed it. Would it be better to put it back in?
Dec 4 '07 #3
FishVal
2,653 Expert 2GB
It is rather weird.

I guess both forms: popup and that opening popup are unbound. Am I right?
Dec 4 '07 #4
kjworm
26
It is rather weird.

I guess both forms: popup and that opening popup are unbound. Am I right?
The form that the popup is opened from is unbound. On this form, however, there is a subform that is bound to a query.

The popup form is bound to my master table, except for the user input fields which are unbound. My insert statement is taking some of the info from the popup that is pulled from the master table along with the user input and inserting this information into a different table.
Dec 5 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
There are a couple of things I would suggest ...
  • Check the spelling including upper case lettering of the table name
  • Check the spelling of all field names
  • Check the datatype of all field values are accounted for in the query
  • Are any field from this table not included in the update, if so then check that none of those fields are set to required.
  • Add the Me! identifier before all control names and check that all control name properties are correct. Remember that it doesn't matter if the control source of the textbox is ShortPN, that doesn't mean the the textbox is called ShortPN.
  • Double check the output of Debug.Print and make sure all the values are as expected.
  • Try copying the text of the SQL statement from the immediate window after the debug.print and paste it into a query. Save the query and see if that works or gives any errors.
  • Try renaming the table to tblQueue and see if that helps.
  • Lastly, try recreating the table and importing the data from the original table after you create the new one. It's possible you have a corruption problem with this table.
Dec 11 '07 #6
kjworm
26
There are a couple of things I would suggest ...
  • Check the spelling including upper case lettering of the table name
  • Check the spelling of all field names
  • Check the datatype of all field values are accounted for in the query
  • Are any field from this table not included in the update, if so then check that none of those fields are set to required.
  • Add the Me! identifier before all control names and check that all control name properties are correct. Remember that it doesn't matter if the control source of the textbox is ShortPN, that doesn't mean the the textbox is called ShortPN.
  • Double check the output of Debug.Print and make sure all the values are as expected.
  • Try copying the text of the SQL statement from the immediate window after the debug.print and paste it into a query. Save the query and see if that works or gives any errors.
  • Try renaming the table to tblQueue and see if that helps.
  • Lastly, try recreating the table and importing the data from the original table after you create the new one. It's possible you have a corruption problem with this table.
Thanks for the help. I figured out why the table was locked while checking your suggestions:

On my main form that the popup is initiated from there is a subform based on a query. This query is pulling data from my tblMasterList and my tblQueue. The popup button used to execute my INSERT INTO statement attempts to insert data into my tblQueue that is already open by the subform. My fix was to close the subform before opening the popup and then reopening the subform after running the SQL. This seems to work fine. My goal was to be able to add data via the popup and then have that data immediately displayed in my subform. If there is a better way to do this, please let me know!
Dec 12 '07 #7
MMcCarthy
14,534 Expert Mod 8TB
Thanks for the help. I figured out why the table was locked while checking your suggestions:

On my main form that the popup is initiated from there is a subform based on a query. This query is pulling data from my tblMasterList and my tblQueue. The popup button used to execute my INSERT INTO statement attempts to insert data into my tblQueue that is already open by the subform. My fix was to close the subform before opening the popup and then reopening the subform after running the SQL. This seems to work fine. My goal was to be able to add data via the popup and then have that data immediately displayed in my subform. If there is a better way to do this, please let me know!
you would normally be able to add data to tblQueue. Your problem is that your form is locked to read only. This must be locking the table.

You could add some code to set the allow additions property of your form to True before opening the popup and to false when the popup is closed. If you do this though I would suggest you make the popup modal
Dec 12 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Oleg Berfirer | last post by:
I'm running a resource-intensive stored procedure, which reads a file with about 50,000 lines with a BULK INSERT into a temp table, then goes through it and inserts a record for each line into...
4
by: Joel Thornton | last post by:
Whenever something is inserted to a given table, I want to run some shell commands using xp_cmdshell. Would it be a bad idea to put this xp_cmdshell in the INSERT trigger of this table? I...
18
by: Elroyskimms | last post by:
I have a table using an identity column as its Primary Key and two columns (table reduced for simplicity) EmployeeNumber and ArrivalTime. CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (10)...
9
by: adi | last post by:
Hi all, Hope there is a quick fix for this: I am inserting data from one table to another on the same DB. The insert is pretty simple as in: insert into datatable(field1, field2, field3)...
8
by: Kragen Sitaker | last post by:
ERROR: Cannot insert a duplicate key into unique index pg_class_relname_nsp_index We've been getting this error in our application every once in a while --- typically once an hour to once a day,...
16
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the...
9
by: David Eades | last post by:
Hi all Complete newbie here, so apologies if this is the wrong forum. I've been asked to use mysql and asp to make a simple bidding system (rather like a simple ebay), whereby users can use a...
4
by: Michel Esber | last post by:
Hello, Environment: db2 V8 FP 13 LUW Our application currently uses: insert into table values ('A'),('B'),...('Z') We have used CLI arrays inserts (1000 array and commit size) and...
8
by: Santy | last post by:
Hello All, I am new to DB2, Currently i am using DB2 version 8.02 personal edition on Windows XP Professional. And Facing problem with rowlock in insert query. I have created a sample database...
1
by: vasilip | last post by:
Can anyone help me out with these two issues I seem to be having? using the db2 driver for PHP (db2_xxxxxx) functions 1. If I forget, or for some reason db2_commit/db2_rollback doesn't get...
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
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
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...
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
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.