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

Add a new record then open the next form with the same button.

Hi all
I am having a problem in getting my Access 2000 program to work in the way I need it to the source code below is to enter data in a table (simple stuff) but I need it to open the next form ONLY if DoCmd.GoToRecord , , acNewRec = TRUE. I have tried different source codes and even looking at MS Access guilds with no luck


Private Sub Command224_Click()
On Error GoTo Err_Command224_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command224_Click:
Exit Sub

Err_Command224_Click:
MsgBox Err.Description
Resume Exit_Command224_Click

End Sub


VISUAL IDEA OF WHAT I NEED (this code doesn’t work it’s just to give an idea).

Private Sub Command224_Click()
On Error GoTo Err_Command224_Click


DoCmd.GoToRecord , , acNewRec

IF DoCmd.GoToRecord , , acNewRec = True then

DoCmd.OpenForm "Preparation"

Exit_Command224_Click:
Exit Sub


Err_Command224_Click:
MsgBox Err.Description
Resume Exit_Command224_Click

End Sub


Any Help will be great thank you :)
Apr 20 '07 #1
2 1229
pks00
280 Expert 100+
If this is a bounded form then u can use Me.NewRecord

If Me.NewRecord = True then
msgbox "Yo, we are in add mode"
end if
Apr 20 '07 #2
Thanks for your help

i got it working using this code:

Private Sub Command224_Click()
On Error GoTo Err_Command224_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

DoCmd.OpenForm "Preparation"

Exit_Command224_Click:
Exit Sub

Err_Command224_Click:
MsgBox Err.Description
Resume Exit_Command224_Click

End Sub

It aollows the user to save the record and open the next form with one button PERFECT! only took me 2hrs to figure it out :)
Apr 20 '07 #3

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

Similar topics

3
by: Iain Miller | last post by:
I'm sure this ought to be simple but I can't make it work!! I have a form (based on a query) that holds information about an individual. Each individual has a Unique reference field called...
3
by: William Wisnieski | last post by:
Hello Everyone, Access 2000, I have a main unbound form with a bound datasheet subform . The subform is bound to a query that returns records based on criteria in the main form. The user...
3
by: fred14214 | last post by:
Dear Group: I have built and customized a form using the wizard to put command buttons that will move to the NEXT record or PREVIOUS record. This works, but it needs some refinement. ...
15
by: Steve | last post by:
I have a form with about 25 fields. In the BeforeUpdate event of the form, I have code that sets the default value of each field to its current value. For a new record, I can put the focus in any...
3
by: Nhmiller | last post by:
I searched here for an answer. I am entering records into a database, and it would save a lot of time if I could duplicate a record that is very similar to the new one I am about to enter, then...
4
by: Jim M | last post by:
Two questions: 1) I have a scheduling application (Access 2002) that allows multiple staff members to edit notes on their meetings and appointments from their offices. A receptionist views a...
6
by: erick-flores | last post by:
Hello all, Form A & Form B Form B opens when I click on a button from Form A. How do I setup Form B so it will always let me insert new records. Because right know, when I click on the button...
1
by: Tony Dunn | last post by:
I have inherited another developer's database (Access 2003) and with it a problem I'm struggling with. The problem is this. I have a parent-child form pair, which is populated by a table (the...
4
by: Steven | last post by:
Hi, Would need some thought about using a button of the existing form to search record before deleting it. Any quick help is very appreciated. Steve
8
by: jmarcrum | last post by:
I have a table with about 100 records. The user has the ability to click a button on the main form that will open up a "move to the next year" form. A query displays all 100 records on the...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.