Solved

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

Posted on 2012-03-20
3
308 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
[X]
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
  • 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

717 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