It works fine. Just one question, did you use two quotes and one apostrophe?
Kambiz
From: "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: "MS_Access_Professionals@yahoogroups.com" <MS_Access_Professionals@yahoogroups.com>
Sent: Tuesday, December 13, 2016 3:02 PM
Subject: Re: [MS_AccessPros] Need code correction
Close, but no cigar. Like this:
Private Sub ComPayCode_AfterUpdate(Cancel As Integer)
If Not IsNull(Me.ComPayCode.Value) Then
ComPayCode.DefaultValue = "'" & Me.ComPayCode & "'"
End If
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
On Dec 13, 2016, at 8:45 PM, Kambiz Afshartous kenaf42@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
John thanks as always. Then is the following correct for the Text Box?
Private Sub ComPayCode_AfterUpdate(Cancel As Integer)
If Not IsNull(Me.ComPayCode.Value) Then
ComPayCode.DefaultValue = "" & Me.ComPayCode & ""
End If
Kambiz
From: "John Viescas JohnV@msn.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com>
To: "MS_Access_Professionals@yahoogroups.com" <MS_Access_Professionals@yahoogroups.com>
Sent: Tuesday, December 13, 2016 1:40 PM
Subject: Re: [MS_AccessPros] Need code correction
Ken-
It looks like you're trying to set the Default Value for the next new row based on what is set in the current one. For that, you should be using AfterUpdate, not Before. And why are you putting hashtags around the value? You need to do that only when the value is a datetime. If the value is text, you need to add quotes.
As for DropDown - it's a long-standing bug in Access that it works in some combos but not all.
John Viescas, Author
Effective SQL
SQL Queries for Mere Mortals
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications
(Paris, France)
On Dec 13, 2016, at 7:31 PM, kenaf42@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:
__._,_.___
Posted by: Kambiz Afshartous <kenaf42@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (5) |
Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.
.
__,_._,___
Tidak ada komentar:
Posting Komentar