Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2012-03-20
3
306 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 500 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

856 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