473,387 Members | 1,545 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,387 software developers and data experts.

Saving data in Access table with VB ?

I have a form with a button and if you click the button, a list of invoices
are generated and saved in the table 'Invoice'.
Problem is, the data isnt saved :(

Here's my code:

Private Sub Knop0_Click()

Dim Invoicenr As Long
Dim Invoicedate As Date

stdocname = "Invoice"
DoCmd.OpenTable stdocname, acViewNormal, acAd

Invoicenr = 111111
Invoicedate = Now

DoCmd.Save acTable, stdocname

End Sub

What am I doing wrong ?
Jul 3 '07 #1
2 4241
I'm going to offer a solution without answering your question:

Dim strSQL as string

strSQL = "INSERT INTO Invoice(Invoicenr, Invoicedate) SELECT 111111, '" & Now
() & "';"
DoCmd.RunSQL strSQL
Bauhaus wrote:
>I have a form with a button and if you click the button, a list of invoices
are generated and saved in the table 'Invoice'.
Problem is, the data isnt saved :(

Here's my code:

Private Sub Knop0_Click()

Dim Invoicenr As Long
Dim Invoicedate As Date

stdocname = "Invoice"
DoCmd.OpenTable stdocname, acViewNormal, acAd

Invoicenr = 111111
Invoicedate = Now

DoCmd.Save acTable, stdocname

End Sub

What am I doing wrong ?
--
Message posted via http://www.accessmonster.com

Jul 3 '07 #2
Thnx, I'll try it :-)
Jul 4 '07 #3

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

Similar topics

1
by: ARobi | last post by:
I edit data from a form by using docmd.close acform, formname, acsaveyes. The form closes properly and returns the control to the father form as it should be. The problem is that when from the...
6
by: S. Graefner | last post by:
Hello Folks, I'm a Relitive newbie to the blood sport of MS ACCESS. I have designed and built a database with multiple, Related, tables. The db works well, more by good luck then good planing I...
1
by: R. Yang | last post by:
Hi, I've a question regarding saving the data. I noticed some of my recently-entered data mysteriously disappeared. There was nowhere to re-locate them. Plus, those data were entered within the...
13
by: Stuart McGraw | last post by:
I haven't been able to figure this out and would appreciate some help... I have two tables, both with autonumber primary keys, and linked in a conventional master-child relationship. I've...
4
by: dale zhang | last post by:
Hi, I am trying to save and read an image from MS Access DB based on the following article: http://www.vbdotnetheaven.com/Code/Sept2003/2175.asp Right now, I saved images without any...
18
by: TORQUE | last post by:
Hi, Im wondering if anyone can help me with a problem. I have a form with more than 50 unbound fields. Some of the fields will be blank from time to time. This seems to be where im having...
4
by: Pedro Leite | last post by:
Good Afternoon. the code below is properly retreiving binary data from a database and saving it. but instead of saving at client machine is saving at the server machine. what is wrong with my...
3
by: Nathan Guill | last post by:
I have an interface that works with an Access back-end. I would like to store and/or load user defined query strings per each user (i.e. no user can access another's queries). The idea I had was...
4
by: SilentThunderer | last post by:
Hey folks, Let me start out by letting you know what I'm working with. I'm building an application in VB 2005 that is basically a userform that employees can use to "Clock in". The form...
1
by: nmrpa91290 | last post by:
I have a vb 2005 program that I am writing. It is just a form with a datagridview, textbox, and import command button. The code looks like this: Private Sub Form1_Load(ByVal sender As...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...

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.