Solved

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

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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
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.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

810 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