Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Microsoft Access  -----------   doubleclick on a field to change it's value

Posted on 2012-03-20
3
Medium Priority
?
313 Views
Last Modified: 2012-06-21
Hi

I am using a continuous form in Access 2010.

I have a database field [tag] which only accepts "Y" or "N".  It's the only field that I have not locked.    I can type in "Y" or "N" and that is fine,  but I would like to do this programically via double click.  Here is the code.

Private Sub Tag_DblClick(Cancel As Integer)
If Nz(Me.[Tag]) = "Y" Then
    [Tag] = ""
Else
    [Tag] = "N"
End If
End Sub
0
Comment
Question by:peispud
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
danishani earned 2000 total points
ID: 37745590
Why don't you use a Boolean field yes/no?


If you persist, try this, replace Text22 into your Name "Tag":

Private Sub Text22_DblClick(Cancel As Integer)

If IsNull(Me.Text22) Or Me.Text22 = "" Then

Me.Text22 = "Y"

ElseIf Me.Text22 = "Y" Then

Me.Text22 = "N"

ElseIf Me.Text22 = "N" Then

Me.Text22 = "Y"

End If



End Sub

Open in new window


Hope this helps,
Daniel
0
 

Author Comment

by:peispud
ID: 37746034
Nope...  That works fine on a regular textbox but does not work on the datafield in a continuous form.
0
 

Author Comment

by:peispud
ID: 37746212
I figured out that I have to create a recordset based on the primary key and update this field.

Thanks for your input though!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question