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

Code is Wrong?

DS
What in this code is stopping me from adding new records?

Private Sub ListProd_Click()
On Error GoTo GotError
DoCmd.GoToControl "[Sales Details]"
Me![Sales Details].Form.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Me![Sales Details]![ProductID] = Me.ListProd.Column(0)
Me![Sales Details].Form.Dirty = False
Me![Sales Details].Form.AllowAdditions = True
'DoCmd.OpenForm ("Modifiers")

ExitSub:
Exit Sub

GotError:
Select Case Err.Number
Case 2501
Resume ExitSub
Case Else
MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf & "Why Not"
Resume ExitSub
End Select
End Sub

Thanks
DS
Nov 13 '05 #1
1 1429
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You need to set focus on the subform control before using the GoToRecord
command.

Me![Sales Details].Form.AllowAdditions = True
Me![Sales Details].SetFocus
' Sometimes you need to set focus on a control in the subform
'Me![Sales Details]!ControlName.SetFocus
DoCmd.GoToRecord , , acNewRec

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQlV+9IechKqOuFEgEQJW5wCfejNI4DMct/B9K4u2N3wxUEZ+dV4Ani/7
HxO80gTjAgQGhZ+5n42zZeEo
=4Gyp
-----END PGP SIGNATURE-----
DS wrote:
What in this code is stopping me from adding new records?

Private Sub ListProd_Click()
On Error GoTo GotError
DoCmd.GoToControl "[Sales Details]"
Me![Sales Details].Form.AllowAdditions = True
DoCmd.GoToRecord , , acNewRec
Me![Sales Details]![ProductID] = Me.ListProd.Column(0)
Me![Sales Details].Form.Dirty = False
Me![Sales Details].Form.AllowAdditions = True
'DoCmd.OpenForm ("Modifiers")

ExitSub:
Exit Sub

GotError:
Select Case Err.Number
Case 2501
Resume ExitSub
Case Else
MsgBox Err.Number & vbCrLf & Err.Description & vbCrLf & "Why Not"
Resume ExitSub
End Select
End Sub

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
19
by: Vinod | last post by:
Hi, I have got a peculiar requirement. I want to distinquish between the color codes. I have got two text fields and i will enter the color codes there. The first text field will have ...
1
by: Matthew Wilson | last post by:
I need to write a function crc(msg, len) that gets a char array of length len and then calculates the crc32 for the code. I don't understand what's going wrong in the code I have. It goes...
5
by: Nikola | last post by:
Compiler prompts a dosen errors Proffessionals, HELP! I's not english, try anyway ... thanks #include<stdio.h> #include<stdlib.h> #include<string.h> struct osoba {
6
by: Jon Jagger | last post by:
I was thinking about how you can only use sizeof to find the size of an unmanaged type. I started to wonder if there was a way to find the size of a managed object and came up with the following....
192
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
9
by: Pyenos | last post by:
import cPickle, shelve could someone tell me what things are wrong with my code? class progress: PROGRESS_TABLE_ACTIONS= DEFAULT_PROGRESS_DATA_FILE="progress_data" PROGRESS_OUTCOMES=
232
by: robert maas, see http://tinyurl.com/uh3t | last post by:
I'm working on examples of programming in several languages, all (except PHP) running under CGI so that I can show both the source files and the actually running of the examples online. The first...
25
by: Jon Slaughter | last post by:
I have some code that loads up some php/html files and does a few things to them and ultimately returns an html file with some php code in it. I then pass that file onto the user by using echo. Of...
27
by: George2 | last post by:
Hello everyone, Should I delete memory pointed by pointer a if there is bad_alloc when allocating memory in memory pointed by pointer b? I am not sure whether there will be memory leak if I do...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.