473,657 Members | 2,493 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Use data entry form to scroll through existing records

33 New Member
Hi, all! I'm a new user, looking to get some help on a form problem in MS Access 2007 I haven't been able to crack.

I've built a form that prompts users to enter new record data, then click "Update Database" to save the record to the table. Each entry creates a new record in the original table (all data goes to the same table).

I've used the button wizard to add a "previous record" and a "next record" button, which work in the sense that they allow the user to scroll forward and backward through all the records they've input in a single "session" (one session = whatever happens between the time the file is opened and the file is closed) However, when a user arrives at the first record they entered and clicks "previous record" again, the message "You can't go to the specified record" is displayed. I thought this might have something to do with the macro, so I went into the "GoToRecord " action in both the "previous record" and the "next record" macros and added the following arguments:

OBJ Type: Table
OBJ Name: Table1
Offset: 1

Now, when a user goes to the first record entered in the session and clicks "previous record," the error message "The object 'Table1' isn't open."

So I went back to the navigation pane, opened up Table 1, then went back to the form and tried to click "previous record" again. Back to the original "You can't go to the specified record" message again.

I tried closing the database after entering records, then opening it up again, and when I clicked the "previous record" button when the form opened with all blank fields in the control boxes, the error message "You can't go to the specified record" displayed.

I'm about at the end of what I know to do and try--if anyone has any suggestions/hints, I'd appreciate it! Thanks!
Nov 18 '09 #1
11 11420
missinglinq
3,532 Recognized Expert Specialist
You need to go into the Properties sheet for the form (don't know exactly how you do that in 2007) and set Data Entry to No.

The name for this property is very misleading! Having it set to Yes is not necessary in order to enter new records! Having it set to Yes means that you can only enter new records! You cannot view pre-existing records, which is where your problem lies!

Remember to remove the things you added to the macros.

Linq ;0)>
Nov 18 '09 #2
dizzydangler
33 New Member
OK, that worked! (you're right, the terminology was misleading--never would have guessed that)

Only problem now is that the form opens with the data from the very first record displayed--I could add a "go to last record" button, but I'd rather eliminate this step (and the possibility that someone could change the first record inadvertently) by having the form open up with blank fields in the controls, ready to accept a new record. Is there a way to do this while maintaining the ability to scroll back through previously entered records?
Nov 18 '09 #3
NeoPa
32,568 Recognized Expert Moderator MVP
Either :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.GoToRecord(Record:=acLast)
or :
Expand|Select|Wrap|Line Numbers
  1. Call DoCmd.GoToRecord(Record:=acNewRec)
depending on your requirement.
Nov 19 '09 #4
dizzydangler
33 New Member
NeoPa--that's great! The form looks exactly like I want it to when it opens. BUT, now the "previous record"/"next record" buttons don't work--I get the "can't go to specified record" error message. It seems like the command to go to a new record continues to execute, rather than being something that only executes once, when the form is opened. Code is currently:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Call DoCmd.GoToRecord (Record:=acNewRec)
  3. End Sub
Nov 19 '09 #5
NeoPa
32,568 Recognized Expert Moderator MVP
That's because you have it in the Form_Current() event procedure. This runs every time you go to any record. Consider what happens when you go to the first record for instance? It hits this code and says "Right - back off to the end again".

I would expect something like the Form_Open() event procedure might be more workable.
Nov 19 '09 #6
dizzydangler
33 New Member
OK, Form_Open() gave me a "procedure declaration does not match description of event" error, but I got it to do exactly what I want (open w/blank controls ready to enter a new record, but allow user to scroll backwards/forwards to view and edit previous records) with the Form_Activate() event procedure. Thanks!

Joe
Nov 23 '09 #7
NeoPa
32,568 Recognized Expert Moderator MVP
You could be getting yourself into unexpected problems there Joe.

Besides, your Form_Open() problem needn't be an issue I expect. I suspect you've copied the whole procedure across and just made changes to the name. What you should do, until you're more familiar with the correct format for each event procedure (some, but not all, have specific requirements as to how they're defined), is simply to create the event procedure template automatically from the Access Form Properties page. When that is there - it will have a single empty line as contents - replace this line with the code contained in your previous procedure. This should leave you with a properly defined and fully working event procedure.
Nov 23 '09 #8
dizzydangler
33 New Member
OK, working through the form properties, I built the command under the Form_Open() sub--still no luck. Access help seems pretty worthless when it comes to figuring out definitions for commands/functions/etc, so I just went down the list trying each one. Form_Load() seemed to give me the same results as Form_Activate() . Would this be a better event procedure to use?
Nov 25 '09 #9
nsbecker
5 New Member
I believe that the Form_Load event is the one you'll want to use - the Form_Open event is the first event that fires - before the form is even populated with data. Thus, attempting to move to a new record when you have yet to bind the form to the data is probably what is giving you the error.

My rule of thumb: setup routines (including dynamically setting the RecordSource) for the form can get called from Form_Open, but anything dealing with data/records in the form are better called from Form_Load.

The problem with Form_Activate is that this event fires when the form regains focus; so, as NeoPa warns, you might run into unexpected behavior if the user navigates away from the form in the midst of editing a record, then returns to it and, wha-lah, are taken to a brand new record.

All the best--
Nov 25 '09 #10

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

Similar topics

1
2868
by: Alex Wisnoski | last post by:
Access 97SR2-I am trying to create a Job Position data entry form based on a table. The form has 15 fields on it. I want to use a combo box to look in the table and see if the position number already exists. If the position exists, then pull up that record and display the information on the form. If the position doesn't exist, inform the user and ask if they want to add it. If they elect to add it, then have a new record to add it in...
1
3273
by: Momo4 | last post by:
I have a unbound main form with unbound fields that correspond to fields on a bound data sheet subform. As you enter data on the subform, the corresponding fields get updated through code (e.g. Me. = Forms!!) All of the new records on the subform are related through the "RunNumber" on the main form. The main form also subtotals the weights on the subform to allow the user to double check totals against paperwork. When the user wants to...
1
2389
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting about 80 records from the Orders table. 80 out of a 1000 records. Now our data entry form shows our customer addresses, but not customer order history. When looking at all of the tables, customer, payments, orders, they still have all of the...
6
1927
by: Brian Blair | last post by:
I have created a input form that enters a number in a talble. If I open the form again it enters a new record instead of editing the existing record. It seems like it should be very basic but I see no way to do it other than a complicated macro.
3
7493
by: bosmatthews | last post by:
I have a main form with a subform and a second subform nested to the first subform. The data entry property for all three forms (main, subform and sub-subform) is set to "yes" because I am intending this form to be used for data entry only. The main form has a combo box from which the user can select a lake. The first subform allows the user to enter survey data for the lake. The sub-subform allows the user to enter additional (plant...
20
6911
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an "Outcomes Database" used to store response data from measures/ questionnaires for a longitudinal health study. It is essentially derived from Duane Hookom's Survey Database (thanks Duane!!!), with many modifications added to fit the needs of my lab.
3
4074
by: chuch | last post by:
Hi, i have created a database to store contractors invoices. I have approximately 9 tables and 3 forms. One of my forms(frmContractors) has all the contractor details and this also contains a sub form which includes cost details. In the sub form i have included a button which activates a pop up form where additional details can be entered. I would like the new data being entered in to the pop up form to be saved so that it can be viewed in...
2
2059
by: ilikebirds | last post by:
Access 2003: I notice that on a form there is a menu for RECORDS - Data Entry. What occurs here is when data is updated and the option is selected It enters the data into the table and starts the form back at 1. This would help in the mouse scroll case where users enter data and can still scroll through the records Would it be wise to place an OnEnter event at the last record to Run this Alt+R+D, so Data is entered and the form is...
9
21609
by: tbeers | last post by:
I apologize for what is probably a simple solution. I have a data entry form that I use to enter work times. I have the default view set to "continuos forms" and the form is enter through a criteria box. The trick is that I want the user to see all the records according to the criteria box but I don't want the user to be able to edit the existing records but still have the ability to enter new records. I have added a "locked yes/no box in...
0
8325
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,...
0
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
5643
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
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1734
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.