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

How to add a record to a table?

sueb
379 256MB
I'm writing a little piece of code to go behind a form that needs to add records to an existing table. Here's the line that VBA doesn't like:

Expand|Select|Wrap|Line Numbers
  1.         AllocationsRecordSet.AddNew ( _
  2.             Array("Month", "Service Category", "Minutes") _
  3.           , Array("Month_Begin", ServicesRecordSet.Fields("Service_Category"), "Months_Minutes"))
  4.  

The error says:

Compile error: Expected: =

I read a little (always a dangerous thing) about how to use AddNew, so I'm trying to supply the field names in the first Array, and the values in the second Array. My first field value is a date, my second is a string, and the last is an integer.
Mar 29 '11 #1
2 1385
Brian Connelly
103 100+
Try .AddRange(variable)
more here
Mar 29 '11 #2
gershwyn
122 100+
The AddNew method does not take any arguments, it just creates a new blank record for you to fill in. I'm not sure where you got the syntax you're using.

Try something like this:
Expand|Select|Wrap|Line Numbers
  1. With AllocationsRecordSet
  2.   .AddNew
  3.   !Month = Month_Begin
  4.   ![Service Category] = ServicesRecordSet!Service_Category
  5.   !Minutes = Month_Minutes
  6.   .Update
  7. End With
Mar 29 '11 #3

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

Similar topics

7
by: Warren Wright | last post by:
Hello, We maintain a 175 million record database table for our customer. This is an extract of some data collected for them by a third party vendor, who sends us regular updates to that data...
10
by: Mark | last post by:
I have a table about people containing 25 fields. The table contains the usual fields - first, last, address, city, state and zip. There is no primary key. These fields all have data with the...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
2
by: carrionk | last post by:
Hi, I need to compare if certain records are contained whithin a Master Table. The following tables illustrates the comparing tables and the required Result Master Table ============...
5
by: MattPF | last post by:
I have a table that is -- 30 Megabytes 90,000 rows ~65 columns My query goes SELECT city FROM table WHERE zip = 90210; It will then find about 10 matching records.
3
by: meyvn77 | last post by:
Hello - I am looking for the best way to store images in a Access DB. My Idea - I have a table with 150,000 records. These recoreds represent a Crash (Traffic Accident). I have 50 different...
0
by: day | last post by:
Hi I designed my database in access and I use it to migrate to MYSQL. I have a problem can some on help me on how to make a master detailed table with two other tables of which their field are...
1
by: Verticon:: | last post by:
I have a situation where I need a table if bad items to match to. For example, The main table may be as: Table Main: fd_Id INT IDENTITY (1, 1) fd_Type VARCHAR(100) Table Matcher:...
1
by: B | last post by:
Hello All, This is my first time using this list, but hopefully I got the right one for the question I need to ask :). I have a table which has about 4 million records. When I do a search...
8
by: sxs1 | last post by:
I have performance issue with the query which takes 5-10 mins and has table has very less number of records something arround a million records.I need to insert the filtered data into a global temp...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.