Solved

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

759 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now