473,399 Members | 2,278 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,399 software developers and data experts.

Having to click twice to enter new record

106 100+
Below is my code for a button to add new record.
it works but only after a second click and I don't know why. please help.

currentcontact is a global variable. It takes the value of contactid (CID) of the customer I wish to create new record for.
New record is created
I put currentcontact value inot contactid of new record
I call a function that sets states of certain fields
I call a procedure that pulls current VAT rate according to date
Expand|Select|Wrap|Line Numbers
  1. Dim ConfirmRate As Double
  2.  
  3. If Nz(Me.CID, 0) <> 0 Then
  4.  
  5.     CurrentContact = Me.CID
  6.     DoCmd.GoToRecord , , acNewRec
  7.     Me.ContactID = CurrentContact
  8.     Call FieldLockState
  9.     Call VATRateCheck(Date, Date, ConfirmRate)
  10.     Me.VATrate = ConfirmRate
  11.     Me.Refresh
  12. Else
  13.     MsgBox "Choose Client First"
  14. End If
Sep 1 '09 #1
3 2334
FishVal
2,653 Expert 2GB
Have you tried to debug your code?
Sep 3 '09 #2
tasawer
106 100+
I did using msgboxs and debug.print but to no joy.
Sep 5 '09 #3
NeoPa
32,556 Expert Mod 16PB
I'll assume for now you haven't read my last reply to you in your other thread, and have never noticed any of the edit comments I've been to the trouble of posting for you about using the [ CODE ] tags.

Next time though, I will have to issue you an infraction. The tags are not optional and must be used when posting code.

On to the subject at hand :
Fish posted a link behind the word debug. I suggest you visit the thread and allow it to teach you some very useful debugging techniques.

Let us know how you get on.
Sep 5 '09 #4

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

Similar topics

6
by: Sally | last post by:
I need to be able to click in a subform and run code but at the same time I need to be able to scroll the records without running the code. I tried coding the Enter event of the subform control but...
5
by: Jerry Crosby | last post by:
Strangely, one of my forms has acquired an odd "feature." On many things that used to require a single click, or a single hit on the Enter key, now require two clicks, or two hits. For example,...
6
by: Michael Johnson Jr. | last post by:
I am trying to handle a button click event, which updates a web control table with data. The button is dynamically created in the table itself. When I call updateTable() in the Page_Load the new...
3
by: Imran Aziz | last post by:
Hello All, I have a search text and button that post data and my button handler filters the repeater control. However when the button is clicked the first time. The page_load event is being called...
4
by: leafboy75 | last post by:
Bit of a strange one. A Label will not update to show how manay records have been found, unless I click the button twice. Anyone know why Code below Private Sub storesrch_Click() Dim...
3
by: yiotie | last post by:
Hi Each time i run a Query ' find customer by Name " I must enter the customer's name twice to get the results. I dblclk the Query, the parameter field appears asking for the customer's name, i...
3
prn
by: prn | last post by:
Hi folks, I've got something that's driving me crazy here. If you don't want to read a long explanation, this is not the post for you. My problematic Access app is a DB for keeping track of...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
2
by: =?Utf-8?B?SGV6YWw=?= | last post by:
Hi, I am trying to add a new record to a table but everytime I click the button, somehow it saves the record twice... I've created a stored procedure to insert records into a table and I called...
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: 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?
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...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.