473,591 Members | 2,810 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to show changes in open Access Database Table in VB?

2 New Member
Re: How to show changes in open Access 2003 Table in VB

I have a form to add a new record to my Access Database table.

This is a code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnAdd_Click()
  2.  
  3.  
  4.    Dim dbExpenses As DAO.Database
  5.    Set dbExpenses = CurrentDb
  6.  
  7. ................................
  8. 'To Get the RecordID
  9. 'Add new record
  10.    Dim rstFDet As DAO.Recordset
  11.    Set rstFDet = dbExpenses.OpenRecordset("Food   Details", dbOpenDynaset)
  12.  
  13.    rstFDet.AddNew
  14.    rstFDet("Food Category ID").Value =  Forms!AddFoodDetRecord!lstFCat
  15.    rstFDet("Food Category Name").Value = Forms!AddFoodDetRecord!lstCatName
  16.    rstFDet("Shop Name").Value = Forms!AddFoodDetRecord!cmbShop
  17.    rstFDet("Date").Value = Forms!AddFoodDetRecord!tbDate
  18.    rstFDet("Type").Value = Forms!AddFoodDetRecord!cmbType
  19.    rstFDet("Name").Value = Forms!AddFoodDetRecord!cmbName
  20.    rstFDet("Quantity").Value = Forms!AddFoodDetRecord!tbQuant
  21.    rstFDet("Coupons").Value = Forms!AddFoodDetRecord!tbCoupons
  22.    rstFDet("Sale Savings").Value = Forms!AddFoodDetRecord![tbSavings]
  23.    rstFDet("Amount").Value = Forms!AddFoodDetRecord!tbAmount
  24.    rstFDet.Update
  25.  
  26.    rstFDet.Close
  27. .......................................................
  28.  
  29. 'Enable Undo action
  30.    Me!btnUndoAdd.Enabled = True
  31.  
  32. End Sub
  33.  
  34.  
All works OK.
The only problem I have: If the table "Food Details" is open in other window in Datasheet view, no changes are visible.
Obviously, I should add some line to the code, but I don't know what it should be.

How to refresh the table's datasheet view programmaticall y in VB?
Feb 6 '11 #1
2 2061
Stewart Ross
2,545 Recognized Expert Moderator Specialist
You can't really update a table viewed in datasheet format, so instead I'd suggest that you design a form for displaying the table (or query) concerned in datasheet format. Once this is done you can easily add a line of code to the end of your update routine which will requery the form:

Expand|Select|Wrap|Line Numbers
  1. Forms("YourDataSheetFormName").Requery
By the way, it is good practice not to have tables opened directly by users. Always use appropriate forms to front-end the tables.

-Stewart
Feb 6 '11 #2
George Yar
2 New Member
Stewart, thank you for replay.

It works just fine.
Feb 7 '11 #3

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

Similar topics

6
506
by: Mark | last post by:
I get an error message when deleting rows from a table in Access database. My understanding is that the error message relates to the sharing of the Inetpub and the wwwroot directory. While I have set the directories to "Share" in the properties window, it still does not allow row removal. I'm running Microsoft Windows XP, Professional, Version 2002, Service Pack 1.
1
10942
by: bailee220 | last post by:
I have included the following code to open an Access database form from within an exsisting Access database. But when I run the code, it appears that it opens the database because in windows explorer I can see the database has the .ldb file extension. So it appears that it's open, but I can't see the database or the form that I've tried to open. What am I doing wrong. The following is the code: 'This is in the declaration part of...
3
2985
by: nvx | last post by:
Hello everyone... Just for the record, I'm a newbie to this data binding thing... In my C# application I need to bind a cell of an Access database table to a multiline TextBox. How should I do it? I've tried to bind the TextBox using the VS IDE (which ended up in binding to a table column). This was perfect until I used the Update command. Then an exception was thrown, telling me, that to update a database it needs to have a DataRow...
6
7594
by: kareemaffan | last post by:
Hello Everyone I want to insert values into MS Access database through VB.NET in Visual Studio 2005 . I have used the following code which is not working. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim con As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=DSA.mdb") con.Open() Dim cmd As New OleDb.OleDbCommand("insert into...
4
13995
by: KMEscherich | last post by:
Version of Access = 2003 Hi there, is there a way to capture data using TERADATA SQL Assistant and import a portion of this database table into a Microsoft Access database table??? I currently have Teradata SQL Assistant and write SQL to retrieve data from clarity tables. I would like to have a button on a Microsoft Access form that would retrieve data directly from Clarity tables and import into a specific Microsoft Access database...
24
3686
by: jerrydigital | last post by:
Hello, I am new to this forum but have read several posts and I thank you for your great assistance. I am stumped right now. I have a user registration form in asp that is set to a form method=registration.asp page. i will post my registration.asp page below. I am hoping this asp page will connect to my access database called registration.mdb with a table called registration. however, everytime i submit my registration information, I...
5
4815
by: asmi | last post by:
I am new in C# programming. Can anyone plz help me in the following problem. I am changing values in different columns in access database table using c# but these changes are only visible at run time. I want to save these changes in the table without adding new rows, just want to replace old values with new ones. I'v used the "adapter.Update" command but it does not work. Plz reply me thankx in advance
2
2401
by: KMEscherich | last post by:
Hi there, am wondering if there is a way to do the following: I developed a Crystal report that runs against a Clarity table envrionment. The report runs fine. I have been asked to run my parameter form - Crystal report against an Access database table. Once the report runs against this Access table, I need to be able to export/convert into a PDF format, then transfer this PDF report into a folder on our shared drive. Not sure if this...
0
1327
by: Brian Connelly | last post by:
I am writing a "Form" program that will check a some data received from a LDAP connection against an Access database. What I would like to do is have the user to manually click a button and update the Access Database. They will need to do this every 6 or 12 months. How do I code a button to call me Access Database and Open it in it's own application. I believe this is what is called the opening the Access COM? Thanks for your help.
0
7934
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7870
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,...
1
7992
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6639
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...
1
5732
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 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...
0
5400
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
3891
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2378
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
0
1199
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.