Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

MS Access VBA Need help with statement to control another field

Posted on 2013-01-28
9
Medium Priority
?
230 Views
Last Modified: 2013-01-28
Why doesn't this code work?

 If IsDate(Me.AendDate) = True Then -----------------This part works fine.
        Me.Status = "Completed"
    Else
If IsDate(Me.AendDate) = False Then -----------------This part doesn't work. If date is deleted,
        Me.Status = "Working"                      I want the status field to change to "Working".
       End If
    End If
End Sub
0
Comment
Question by:DJPr0
[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
  • 3
  • 3
  • 2
  • +1
9 Comments
 
LVL 6

Accepted Solution

by:
nickinthooz earned 2000 total points
ID: 38827941
take out

If IsDate(Me.AendDate) = False Then

You're using else and a boolean so it can only be true or false, if it's not true then it's got to be false?
 If IsDate(Me.AendDate) = True
        Me.Status = "Completed"
    Else
        Me.Status = "Working"                
       End If

Open in new window

0
 

Author Comment

by:DJPr0
ID: 38828000
Only the first part works (Completed)

Does the After Update kick in when the date is deleted?

The "Completed" doesn't change to "Working" when the date is deleted.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38828031
try something like this

 If IsDate(Me.AendDate) = True and me.AendDate & ""<>"" then
        Me.Status = "Completed"
    Else
        Me.Status = "Working"                
       End If
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Expert Comment

by:nickinthooz
ID: 38828047
if you delete the date, you need to put the code somewhere it can check, like the on change event or after the focus to the date field is lost.
0
 

Author Comment

by:DJPr0
ID: 38828053
Same problem - Works only for "Completed".
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 38828069
DJPro
where did you placed the codes ?

and when responding, pls, mention the expert to whom you are responding.
0
 
LVL 26

Expert Comment

by:jerryb30
ID: 38828079
Private Sub aenddate_AfterUpdate()
If IsDate(Me.aenddate) Then
Me.status2 = "Completed"
Else
Me.status2 = "working"
End If
End Sub

works for me after leaving aenddate after a deletion.
0
 
LVL 6

Expert Comment

by:nickinthooz
ID: 38828087
what about

 If IsDate(Me.AendDate) = True
        Me.Status = "Completed"
    Elseif  isnull(me.[fieldname]) then
        Me.Status = "Working"                
       End If

Open in new window


change your fieldname to whatever your fieldname is.
0
 

Author Closing Comment

by:DJPr0
ID: 38828141
I had some conflicting code that ran above this statement.

Sorry for the confusion.

The first post works fine.

Thanks!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

604 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