I have a web based inventory database setup so that when a user adds a new purchase order(PO) it is automatically inserted into the stocks table. Now, when I go to the grid view of my stocks table the inserted record shows up, but when I go check it out on the database it is not there, what seems to be the problem?
This is the link to my code: http://pastebin.com/download.php?i=BiYmDQt1
What is between your page and the database, do you add everything to an array or an xml file or something before writing it to the database, that your grid view reads from? can we see some code? :)
maybe the issue is related to this part being commented, out, or maybe its so late I am delirious
/* DbParameter parStockOut = dbStockInsert.CreateParameter();
parStockOut.ParameterName = "#Stock_Out";
parStockOut.Value = "";
dbStockInsert.Parameters.Add(parStockOut);*/
I've found the solution to my problem, looks like mysql workbench just shows the first 1000 records in a table so all I have to do is toggle row limitations for all records to show up.
Related
I am running into a problem doing something very simple with MS Access data macros. When a record row is deleted from T_Roster, I want it copied to t_Deleted. I know there are a plethora of other and better ways to accomplish this however, the requirements for this are such that a data macro is required. The end user/manager does not want me to add columns to the roster table or use a form (both of which I had initially suggested). That said, I have been scouring the internet for a solution and see that this question has been answered however, I have not been able to get the simple macro to work on my end. I have finally worked up the nerve to ask the question here again so please be kind.
There are only 2 tables in this DB. t_Deleted and T_Roster
I have attached a screen shot of what my current macro looks like. In the interests of keeping things simple, I only want the "OCIO_Name" to copy over for now. I assume that if this test works, the rest of the fields will not be an issue.
Table properties are as follows:
T_Roster Table Properties
t_Deleted Table Properties
Macro in T_Roster:
T_Roster AfterDelete Macro
Can anyone tell me what is wrong with what they see?
edit Does not work means that t_Deleted is not updated when I delete a record from T_roster.
Fields set as required will prevent creating new record unless data is provided for them. Either don't set as required or provide data.
I want to preface this by saying I don't have any real programming background, I'm just trying to update an existing database at work.
We have an access database and I want to add an additional Y/N checkbox to an existing form. The form updates a SQL table. Currently the record source is a SQL statement.
I can go to the SQL table, add a new field and make it Yes/No data type. There are other Yes/No fields in the table and the default settings for the new field are identical to the others. I next go and update the linked table through External Data in the ribbon. I can go into the table in Access and see the new field - so far, so good.
Next, go to the form design view and form properties, go to the record source, update the SQL statement to include the new field. (I've also tried this thru query builder, same result.) From here, I start to get the error.
If I go back to form view and change any data in the form and hit the next record button or save button, I get the Write Conflict error. "This record has been changed by another user since you started editing it..." The 'Save Record' button is greyed out. I am the only person accessing the database or SQL server.
I've tried to finish building the new button and linking it to the new field in control source (that went fine), but it didn't make any difference. If I go in to edit the record source and remove the new field, everything works again (but of course, the new field isn't in the control source list, so isn't linked to the check box).
Any ideas? Thanks.
A strong contender for the reason for your problem is the form itself.
Most likely the form is setup with a specific query as the Record Source. Its not to say that that is inherently incorrect, but it makes adding new columns to the source significantly more difficult.
The problem would likely be solved if you just changed the Record Source to reference the table itself, rather than a query, if that is in fact how it is referenced.
If Ms Access tries to pull data from a table using a query through a form it will inherently Pessimistically Lock the table in question, making it unable to be modified. However, you can usually still modify the table through the query itself, but you would need to add the column changes into that query first.
I'm not quite sure if I am making sense here, but something like this (for a table called "Table1"):
In theory, if the form is the problem... then if you closed it and tried to make modifications to the table, then the changes should work when the form is closed.
Someone else fixed it for me, but from what I understand, it was a communication issue between SQL and Access. Something with the setting of the null value in SQL not being set the way that Access could understand.
We had the issue narrowed down. When the new field was added to the table, you couldn't change any info directly in the table, but you could with the form.
If you added the new field to the form's record source, you couldn't edit any info at all.
Thanks for everyone's input.
Good Morning,
I'm fairly new to Access VBA and I've been trying to find a solution to a problem:
I've created a form from which users upload an excel file to a database. File open prompt appears, user selects the file, temp table gets created and data gets pulled to this table. From there a set of macros populate the required fields and push the complete set to a perm table and then temp table gets deleted. Now I would like to take it a step further and try and count how many times a value has been uploaded to the table...
Lets say that the value appears in the table twice already, then if user tries to upload the same value for the third time it will be uploaded to a different table. Bear in mind that the file which users will upload may contain values that will be uploaded for the first, second, third, etc. time.
Do you have any suggestions or solutions to my problem? Is it even possible? If yes then how can I make Access to distinguish which records are being uploaded for the first, second, third, etc. time and follow appropriate paths?
I've been scouting the internet for several days now, but no one seems to have such issue.
Thank you in advance for replies.
I'm not sure I follow. You are essentially trying to prevent inserting duplicate data to a production table and if a duplicate is encountered at the record to a different table?
I'm hoping this will be a rather simple question to answer, as I'm not looking for any specific code. I have a table on a classic asp page populated from an sql server. I've just set the table up so that each row is clickable and takes you to a page to edit the data in the row. My question is this: Would I be better off trying to use the recordset that populated the table or should I reconnect to the db and pull just the record I want edited.
As always; It Depends. It depends on what you need to edit about the record. It depends on How far apart your DB and site are from each other. It depends on which machine, if the DB and site are on separate machines, is more powerful.
That being said, you should make a new call for that specific record. The reason mainly being because of a specification you made in your question:
...and takes you to a page to edit the data in the row
You should not try to pass a record set between pages. There are a few reasons for this
Only collect what you need
Make sure data is fresh
Consider how your program will scale
On point 1 there are two ways to look at this. One is that you are trying to pass the entire record set across a page when you only need 1 record. There are few situations where another DB call would cost more than this. The other is you are only passing one record which would make me question your design. Why does this record set have every item related to a record. You are selecting way too much for just a result list. Or if the record is that small then Why do you need the new page. Why can you not just reveal an edit template for the item if it is that minimal.
On point 2 consider the following scenario. You are discussing with a coworker how you need to change a customer's record. You pull up this result set in an application but then nature calls and you step away from you desk. The coworker gets called by the customer and asked why the record is not updated yet. To placate the customer your coworker makes the changes. Now you are using an old record set and may overwrite additional changes your coworker made while you were away. This all happens because you never update the record set, you always just pass the old one from page to page.
On point 3 we can look back a point 1 a bit. let us say that you are passing 5 fields now. You decide though that you need a comments field to attach to one of your existing fields. do you intend to pass 2000 characters of that comment field to the next page? How about if each of the 5 need a comment field? Do you intend to pass 10,000 characters for a properly paged record set of 10? do you not do record set paging and need to pass 10,000 characters for a full 126 records.
There are more reasons too. Will you be able to keep your records secure passing them this way? Will this effect your user's experience because they have a crummy computer and cannot build that quick of a post request quickly? Generally it is better to only keep what you need and in most situations your result set should not have everything you need to edit.
I have about 11 columns in a mysql table and none of them are empty. When I view these columns in the Browse section, some columns are hidden whereas I'm sure they exist.
I have updated phpMyAdmin to latest version (4.1.5) but that did not solve anything. I also exported the table, dropped it and imported it again but nothing changed.
How do I make all the columns visible?
You could look in the exported file to double-check that they exist there.
Another thing to try; from the table, click the SQL tab. The default text will probably say SELECT * FROM `tablename` WHERE 1, try running that and see if you get any different response.
If you click the Structure tab, do you see the columns that are hidden?
Do you have access to the command-line client? If so, can you test showing the table structure there to see if it's different than displayed by phpMyAdmin?
Edit: Have you tried a different browser?
Marc Delisle points out that the column may be hidden within phpMyAdmin; in the Browse tab look to the left of the column headers, there's a T with two arrows -- to the right of that is a small dropdown arrow. Make sure all your columns are selected there. It's doubtful this is the cause of your problem, because you dropped the table and recreated it, but it's the next thing to check.
Can you copy the table to another database for testing, verify that the problem exists there, then truncate the table (remove all data, see the Operations tab to do this), and see if it continues (that will help determine whether it's the structure or the data causing the problem)?
Can you try to export the structure only and recreate the problem on the demo server (log in with the username root and a blank password)? Can you post the structure here? Make sure you obscure any sensitive information if needed.
This question is a duplicate to this one:
phpMyAdmin doesn't show added columns
so here is my duplicate answer! I don't think I have enough kudos to flag this as duplicate yet.
Database phpmyadmin is used to store which columns are hidden, which column a table should be sorted by, etc etc. Table pma_table_uiprefs (phpmyadmin.pma_table_uiprefs) in particular has columns: username; db_name; table_name; and prefs.
I found the row in that table that matches your db_name,user_name and table_name, and deleted it. That reset the layout back to showing all columns!
The prefs column is text, and it's format could probably be deciphered if you have some spare time and energy, but deleting the row is easy and you can then adjust the layout again in phpmyadmin, and the row will be recreated in phpmyadmin.pma_table_uiprefs.
I was authenticated as root when doing this.
i just solved this with a relatively easy fix! (finally my time to give back :) )
For anyone reading in future, go to operations (top row, same as browse, structure etc). Then under Copy table to (database.table): just change the name of the table, press go. This will create a duplicate that should be fine.
Go to the same area of the problematic table and DROP it under Delete data or table. This will delete the table.
Now go to the operations of your new page and rename the table to the way it was. Like in the image linked.
Image of where to go in PHP Admin: