473,387 Members | 1,588 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.

adding a record to a form

266 256MB
i would like to add a new record to a form and have it appear after the current record i am on... so for instance if i am on record 2 of 5 i would like to insert a new record that would now be the 3rd record on the form... is this possible?
Jan 27 '10 #1
2 1741
Stewart Ross
2,545 Expert Mod 2GB
Not easily, Didacticone. SQL-based databases have no concept of record position; the order in which records appear is defined by field ordering within the underlying query on which you base your recordset (or on the imposed ordering of any indexes used by the database engine for recording primary keys, if you are basing your form directly on a table). Such ordering is not absolute in any sense - you can change it by changing the SORT BY clause in your query.

To do as you want you would need to include some kind of 'sequence number' field in your table. You would need to set this yourself in event-driven code in some way (you can't just use an autonumber field and get the effect you are after). You would have to look after the modification of 'record positions' of other records so you can set the value of the current field accordingly, then re-query your form after adding a new record to the list in place of the current record in third position.

Personally, I'd not recommend such an approach at all - as if you want to change the sort order of your query then your 'absolute record numbering' goes out the window anyway...

-Stewart
Jan 27 '10 #2
nico5038
3,080 Expert 2GB
You can "move" rows by adding a sequence field and manage the order by code. Check my sample http://bytes.com/attachments/attachm...tright2000.zip showing how this can be done by opening the "Up down" form.

The other form shows how you can use one table to move selected items between listboxes.

Nic;o)
Jan 28 '10 #3

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

Similar topics

2
by: David | last post by:
Hi, I have an order form which has a field 'ProductID'. This form has a button on each record to open a new form linked by ProductID. This new form is a continuous form and obviously, only...
2
by: brenda.stow | last post by:
error msg " An error occured while referencing the object. You tried to run a visual basic procedure that improperly references a property or method of an object" This msg occurs everytime I add a...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
6
by: Rudy | last post by:
Hi all, I know this is easy, just can't seem to get it. I have a windows form, and a text box, with a value already in it. I need to add that value to a table. It's just one value, so the entire...
8
by: shumaker | last post by:
I'm wondering if adding an autonumber primary key will improve the performance of a multiuser access database on a network share. I have a website that lists many tips for improving performance of...
3
by: john | last post by:
In my form (table A) I have subform (table B (only 2 fieds: ID and App_name) where table A -Table B are linked 1XM. To be able to add a record in the subform I want to use a lookup form since the...
1
by: ConfusedMay | last post by:
Hi, I'm working on a database that has a form which hold all of our products testing. each product can hold more than 1 complete test (complete test here means that product has to have before and...
1
by: raaaz | last post by:
Hi dears, I am adding a record in Access database using AddNew method of recordset. here is the code of the page .. <% Set RsLibBuild = Server.CreateObject ("ADODB.Recordset")...
0
by: Richnep | last post by:
Hi all,. I have a small issue I would like to resolve with VBA. I have a form which it's fields are bound to a table. Within that form is a subform which is a subtable. Tables relationship...
4
by: bkberg05 | last post by:
Hi I have a form called Customer whose record source is a table called Customer. The primary key is Customer_ID. On that form, there's a subform called sub_Customer_Contact_Log. It's record...
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:
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...
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...

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.