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 ?


0
Bauhaus
7/3/2007 7:52:54 PM
access.formscoding 7493 articles. 0 followers. Follow

1 Replies
894 Views

Similar Articles

[PageSpeed] 52

Answered in microsoft.public.access


"Bauhaus" <niemandhier@pandora.be> wrote in message 
news:7Exii.2418$yf6.1885@biebel.telenet-ops.be...
>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 ?
>
> 


0
George
7/3/2007 8:42:10 PM
Reply:

Similar Artilces:

Remote data access
As a new .net developer, I would like to know how a VB.net Windows application can access a SQL Server database residing on a web server. In other words, using the Visual Studio IDE, is there a way to develop a Visual Basic, Windows application that can access a SQL Server database over the internet. Thanks for suggestions, John C. John C. wrote: > As a new .net developer, I would like to know how a > VB.net Windows application can access a SQL Server > database residing on a web server. > > In other words, using the Visual Studio IDE, is there a > way to develop...

Data Validation #12
Hi. I have data validations in sheet1 as named range lists from sheet2. When I have deleted sheet2 and copy sheet2 from identical other workbook - my validations does is not work... I see Name ranges in copied worksheet, but when I use they in validation - I have error: "The Source currently evaluates an error. Do you wish continue?" Only after deleting of Named ranges in Sheet2 and recreating its, my validations works. It is possible after replacing of worksheet with named ranges for validations (named ranges names are identical) use copied worksheet without recreating ...

Pivot Table not valid error message when formatting data 'button'.
Created Pivot table/chart, password-protected and put onto website (ie NOt saved file as Web Page). Click on link, get warning message concerning macros and prompted for password. If attempt to change data button by rightclicking on it and selecting format - get error message 'Pivot Table not valid'. Note, accessing the file directly (ie not via the web) works perfectly Ok. PS Also get visual basic error message ' Run time error 1004 :Unable to set the default property of the Pivotitem class' VB code Sub All_Years() CP = "(All)" pf = "Year First Seen"...

Data Entry Form 03-20-08
Hi, I created a form to use for viewing currently records and entering new data. This time, the form doesn't allow me to enter new data. In fact, all text boxes didn't let me to enter new information. Please help Thanks Chi Several things to check: In form properties: Allow Additions = Yes Allow Edits = Yes If the form's record source is a query, be sure the query is updatable. -- Dave Hargis, Microsoft Access MVP "Chi" wrote: > Hi, > > I created a form to use for viewing currently records and entering new data. > > This time, the ...

Linking from a pivot table
I have a problem with Excel XP. Under Excel 2000 I would be able to link a Pivot Tables contents to another worksheet using the "=" and clicking in the cell within the pivot table, then using F4 to get rid of the "$" then enter. I would then use the autofill button to drag over the number of coulums I needed to fill, then autofill down to the bottom of the sheet for the number of rows in the pivot table that I needed. It would automatically change each cell designation to the corresponding cell of the pivot table. Now with XP, it doesn't work. When you use...

the criteria pane and table panes have disappered.
In my excel file I can't see the criteria and table panes and the functions will not reappear. ...

"Do you want to save" when Excel OPENS
I understand about the "Do you want to save" message when you close Excel, even if you didn't make any changes: Excel doesn't distinguish between real changes and the recalculation of volatile functions. But at work we've had a user claim that he gets the message when he OPENS Excel when our add-in is checked (having been checked when Excel was open before). Specifically, it asks "Do you want to save changes to Sheet 2?" I'm sure it's not our add-in as such, since no one has ever report this before. But it may be some interaction between our add-...

OWA limited access for Board of Directors
I have a question about my exchange server and OWA. I need to customize it to have limited access for my broad of director via web with easy access for the Board relations manager to maintain the information. The requirements to me was to give the broad access via the web to a calendar,contact and a document folder(with the restriction that the BOD can not delete items plus not be able to email out). I wonder this can be done with Exchange OWA or is ther a better software product would help me On Thu, 20 Apr 2006 06:32:01 -0700, JCS <JCS@discussions.microsoft.com> wrote: >I h...

Stacking Data??
if I have data like this A B C D... 1 Type\Date 01/10/04 02/10/04 03/10/04... 2 T-X 100 50 100 3 T-Y 50 70 0 4 T-Z 400 0 400 ... .. ...

Sorting lots of data
We are trying to sort through a csv file that we converted to an excel spreadsheet. the spreadsheet has over 40,000 entries which include mailing addresses that are in some cases duplicated. is there anyway to sort/filter the info to locate the duplicates and then remove them?? any help would be greatly appreciated. thank you for your responses. Hi use 'Data - Advanced Filters' and check 'unique entries' or use the following addin for this: http://www.rondebruin.nl/easyfilter.htm -- Regards Frank Kabel Frankfurt, Germany miss lynar wrote: > We are trying to sort thr...

Merging tables
Hello, I do not have deep knowledge of Excel. That is why my proble might appear a bit strange: I have two tables, list1 and list2. In both tables there is a colum with unique ID numbers. The rest of the columns contains differen information in both tables. Example: list1 ----- ID name email 101 bob bob@none.com 102 rita rita@none.com ... 999 jim jim@none.com list2 ----- ID salary 102 2000 103 2500 ... 204 2100 What I would like to get as a result is a combined table, with selecte columns from both tables in it. I.e.: list3 ----- ID name salary 101 bob - 102 rita 2500 ... Anyone who can ...

State of VB.NET
What better place to start this thread. I'm very fortunate to find another VB/VB.NET shop here but was out of work for 6 months because (plus the economy in general) I'd not done any production C# work. As I've always suspected Microsoft pretty much favored C# from its introduction. I'm just wondering why employers are buying the C# hype hook line and sinker. There were jobs that I could have taken at 1/3 of my old salary as a Senior Developer (MCSD VB) etc. They would effectively treat me as a junior developer. Heck I couldn't even get those jobs. ...

I lost my Access (Office) 2003 disk
I have MS Office 2003 loaded on my computer, but someone stole all my program disks just over a year ago, and now I'm finding that things like the subform wizard doesn't load automatically with the program, but has to be loaded later from the program disk (I'm working out of some tutorial-type books for Access 2003). Is there some way of getting around this? Either just using Access workarounds, or is there some way of getting a hold of these (apparent) add-ins to the program, either on line or on disc? Thanks Rob, I answered your question in the Forms newsgroup, this morning. -...

Pivot Table fields #2
Is there a way to format multiple pivot table fields at one time and have them refresh that way, rather than having to select each column and choose the format options? Thanks CLou: I think the solution for you is to open the Pivot Table Toolbar and select the Field Settings icon. This sets the format for all results for that particular field. One limitation that I haven't found a way around is getting a preferred column size to "stick" and not reset after a table refresh. Bruce >-----Original Message----- >Is there a way to format multiple pivot table fields at ...

order data by a rank
i need to create a form order by the militaty rank.This form is based in a query "qrystaff" with three fields: MemberID FullName and Rank.I´d like that the data were ordered firstly by MilitaryRank and secondly by FullName in alphabetical order.There is an easy way to do this? -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access/201003/1 When you create queries, you're given the option to specify the sort order under each field. If the fields aren't in the order from left-to-right in the query grid, you can add ...

Turn data #2
Is there a way to turn the data in an Excel spreadsheet so that what is on the top is now on the side and what is on the side is now on top? I need to export my spreadsheet into Access but, I can't get it to format correctly in its current orientation. ~Make a backup copy of your data to work from (just in case, so you don't lose data) ~Highlight the entire range of data; click >Edit >Copy ~Choose a new location, on a different sheet perhaps; click >Edit >Paste Special and select the Transpose box; click OK Does that do it for you? thank you so much. You are a genius...

Pivot Table Refresh Problems
Hi All: Hoping that someone can help. I am trying to refresh a pivot table using the following code which was inserted on the Daily Production Output Sheet(both sheets in the same workbook). I am using Excel 2003 Private Sub Worksheet_Calculate() 'If data on this worksheet changes, refresh the pivot table Sheets("Daily Production Output").PivotTables("PivotTable3").RefreshTable End Sub The Calculation has been set to Automatic. However when I try to run the above code I am getting the following error" Run Time error 1044, Application defined or Object defin...

Copy chart with reference table
I have a pie chart neatly tied to a data table alongside. Now I want to copy both the chart and table to a different area of the sheet so I can modify the new data table and have 2 different charts. My issue is that the chart will only allow absolute references, so when I copy both the chart and table together the new chart still is tied to the old table - so I have to go and change the source data ranges one by one. Any way that I can do this easily? Copy the whole sheet. The copied chart links to the data on the copied sheet. Now cut the range that includes the copied char...

Data in columns not rows
I have file that is names, addresses and phone numbers. When I copy it into excel it comes out like this. (COLUMNA) NAME ADDRESS ADDRESS2 PHONE I need it to be like this COLUMNA COLUMNB COLUMNC COLUMND NAME ADDRESS ADDRESS2 PHONE Is there a way to change this without copying and pasting? Jenn Is the data consistently 4 rows? Or do you have varying sets? How far down Column A do the sets extend? If 4 rows per set try this..... In B1 enter =INDEX($A$1:$A$3000,(ROW()-1)*4+COLUMN()-1,1) Drag/copy across to E1 then select B1:E1 and drag/copy down u...

Is there something like Cond and In in Access?
#1) Cond In old PC FAND, which was base on Pascal, we had the following: SomeValue:=cond(SomeField=1 And OtherField="A": "Excelent", SomeField=2 And OtherField="A": "Almost excelent", SomeField=3: "Hmmm...", else: "Ooops") Is there an equivalent in Access 2007? IMO: 1) Select Case will not do that. 2) Select Case can't be used in computed fields. 3) With IIf it's quite complicated. 4) The easiest way: Public Function. But do I really want a ...

Excel 2007 exits without asking if I want to save
Hi All, I just started using Excel 2007 recently. I notice it exits when I keys in Alt-F4, without confirming if I want to save, even if I had made changes to the workbook. Is there an option which I can set and make Excel 2007 verify if the user, wants to save before exiting? This is the default in earlier Excel versions. Thanks for help. have you recently run a macro in which you forgot to turn on Application.DisplayAlerts =3D True? susan On Nov 24, 5:25=A0am, ch <c...@discussions.microsoft.com> wrote: > Hi All, > > I just started using Excel 200...

pivot tables #19
I want to create a pivot table where I just have to enter the data in once where it will post to a general ledger, income/expense statement, profit & loss report and individual vendor accounts. Can this be done? -- tiki Hi tikitai, Look at my Excel Database Tutorial at http://edferrero.m6.net/DataTutor1.html You should be able to work it out form there. Ed Ferrero > I want to create a pivot table where I just have to enter the data in once where it will post to a general ledger, income/expense statement, profit & loss report and individual vendor accounts. Can this be done? &...

Using a Text / Data output as a cell reference
I am trying to use the end of a column as a divisor and need to convert what i guess is text into an actual cell reference if possible. In column A, say there are 13 data points ending at cell A13. I then try to turn that into a cell reference with the formula ="A"&TEXT(COUNTA(A1:A13,),"0") I put this formula in B1 the output of this is then A13 what i need this to do, is be able to divide any cell by A13. The reason I am going through all this trouble is that there are many columns and each has a different # of data points. I hope this is somewhat clear. Thanks ...

Modify Access 97 tables in Access 2003
How do I modify an Access 97 table using Access 2003 without converting the database? Is there any tool available? Rick This is only one person's experience... There is only one tool I'm familiar with that would let you do that, and it's called ... Access '97<g>! You've described HOW you want to do something. Now, if you'll describe a bit more about WHY you need this done, the folks here in the newsgroup may be able to offer more specific suggestions. Regards Jeff Boyce Microsoft Office/Access MVP "Rick" <Rick@discussions.microsoft.com...

Cashiers changing prices: "access pricing" and discounts
Hi: We are a wine shop and give 10% discounts when customers purchase six bottles of wine, and 20% when they purchase 12 bottles. I've got the discounts to automatically kick in when 6 or 12 bottles are scanned into the system using mix and match. However, I've noticed we get an error about "cashier cannot change prices" when the minimum quantity for discount is entered into the system. The reason is b/c the cashier does not have the "access pricing" check box turned on in their detail setup. The problem is we don't want the cashier to have the &quo...