![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi all, I am a newbie, struggling with this issue: I have three fields on (the same form): ProposalSent (Date field) ProposalAccepted (Date field) Status (Text field) I want the following: Once I update the ProposalSent field, some logic has to check if there is or isn't a date in the ProposalAccepted field. If not, the Status field is changed to 'Waiting', else the Status field is changed to 'In progress'. I think when I attach the same logic to the AfterUpdate events of both Date Fields I should succeed. Private Sub ProposalSent_AfterUpdate() If Me.ProposalSent <> "" And Me.ProposalAccepted = "" Then Me.Status.Value = "4" MsgBox "Status is changed to 'Waiting'" Else Me.Status.Value = "1" MsgBox "Status is 'In progress'" End If End Sub This doesn't work. The *Me.ProposalSent <> ""* part works, but there seem to be some trouble with the *Me.ProposalAccepted = ""* part. Who can help me? Thanks. Koen. |
#2
| |||
| |||
|
|
First, try naming the _Controls_ (text boxes) on your form a different name than the underlying _Field_ in the Table or Query that is the Record Source for a Form. For example, prefix them with "txt" and try the following: If Len(Me.txtProposalSent) > 0 And Len(Me.txtProposalAccepted) 0 Then .... If that doesn't do what you want, then explain why you say that it is "ProposalAccepted" with which you are having trouble. Please follow up or clarify here in the newsgroup, not by e-mail. Thanks. Larry Linson Microsoft Access MVP |
#3
| |||
| |||
|
|
OK. I followed your advice. But the behaviour is still the same. This isn't working (sample 1): Private Sub txtProposalSent_AfterUpdate() If Len(Me.txtProposalSent <> 0) And Len(Me.txtProposalSent = 0) Then MsgBox "Because sent, but not accepted, the status should be Awaiting" Else MsgBox "Status: In progress" End If End Sub |
#4
| |||
| |||
|
|
"Koen" <no (AT) spam (DOT) nl> wrote in message news:Xns93CEF2E7D68D1Rubends (AT) 194 (DOT) 109.133.20... OK. I followed your advice. But the behaviour is still the same. This isn't working (sample 1): Private Sub txtProposalSent_AfterUpdate() If Len(Me.txtProposalSent <> 0) And Len(Me.txtProposalSent = 0) Then MsgBox "Because sent, but not accepted, the status should be Awaiting" Else MsgBox "Status: In progress" End If End Sub Take a closer look at the first line of your If statement. Shouldn't those two control names be different? |
#5
| |||
| |||
|
|
Sorry for this cut and paste error in my previous posting. In access I did it right (see below), but it is not working (as I described in my previous post). Sample 1: Private Sub txtProposalSent_AfterUpdate() If Len(Me.txtProposalSent <> 0) And Len(Me.txtProposalSent = 0) Then MsgBox "Because sent, but not accepted, the status should be AWAITING" Else MsgBox "In progress" End If End Sub |
#6
| |||
| |||
|
|
Hi all, I am a newbie, struggling with this issue: I have three fields on (the same form): ProposalSent (Date field) ProposalAccepted (Date field) Status (Text field) I want the following: Once I update the ProposalSent field, some logic has to check if there is or isn't a date in the ProposalAccepted field. If not, the Status field is changed to 'Waiting', else the Status field is changed to 'In progress'. I think when I attach the same logic to the AfterUpdate events of both Date Fields I should succeed. Private Sub ProposalSent_AfterUpdate() If Me.ProposalSent <> "" And Me.ProposalAccepted = "" Then Me.Status.Value = "4" MsgBox "Status is changed to 'Waiting'" Else Me.Status.Value = "1" MsgBox "Status is 'In progress'" End If End Sub This doesn't work. The *Me.ProposalSent <> ""* part works, but there seem to be some trouble with the *Me.ProposalAccepted = ""* part. Who can help me? Thanks. Koen. |
#7
| |||
| |||
|
| Len(Me.txtProposalSent <> 0) should be: (Len(Me.txtProposalSent.Value & "") > 0) Len(Me.txtProposalAccepted = 0) Should be: (Len(Me.txtProposalAccepted.Value & "") = 0) |
![]() |
| Thread Tools | |
| Display Modes | |
| |