A 2010 VBA if then

I'm not on my machine with Access '10, but I think you should be able to save back to an older version.

As for It Then try this link.

I know I can save it to an older version, but he will lost things like a date picker so if I can't talk him into spending $100. bucks himself I might buy it for him myself. The app he has now is 10 years old made by a student. Its funny to look at. very time they want a new lesson he added a new field. I have already converted his lesson to a separate table so he can add lessons to his hearts content. He had a last name and first initial as a Id key and I have changed that to auto. His request to flag late returns, however, is giving me a little trouble.
 
If you save back to Access '03, you can insert a date picker like the one here. I've used that one a number of time before I moved to Access '10
 
you can get simple datepickers for use in A2003.


anyway, try this

txtdatecomp.visible = nz(txtdatecomp,0)=0
 
If you save back to Access '03, you can insert a date picker like the one here. I've used that one a number of time before I moved to Access '10

That is true, but from past experience clients never know what they want until they use it for a while, then I have to go back in and change it. It will be easier for me if he upgrades.
 
you can get simple datepickers for use in A2003.
anyway, try this

txtdatecomp.visible = nz(txtdatecomp,0)=0

Thanks for tying:

I though I had it for a minute but while it made "Me.txtDateComp.Visible" it made it visible on moving the next record even if was not null.
Code:
 Private Sub cmdNext_Click()On Error GoTo Err_Handler
 
DoCmd.GoToRecord , , acNext

If txtDateComp.Visible = Nz(txtDateComp, 0) = 0 Then
Me.txtDateComp.Visible = True
End If
 
ccmdNext_Exit:
Exit Sub
 
Err_Handler:
If Err.Number = 2105 Then
   MsgBox "You have already reached the Last subscriber.", vbApplicationModal, "Bibles To You"
Else
   MsgBox Err.Description, vbExclamation, "Error #: " & Err.Number
End If
   Resume ccmdNext_Exit
End Sub
 
you will need the code in the forms current event, so that it gets refreshed each time you move to a new record. (and when the form first opens)

also in any other event that might affect the field.
 
Dick7Access: naturally, because there is no command to make it invisible. Once it is switched to visible, it remains visible. I suggest to move your condition lines to the Form_Current event - and narrow them down to one line:
Code:
Private Sub Form_Current()

    Me.txtDateComp.Visible = IsNull(Me.txtDateComp)
    
End Sub
 
Dick7Access: naturally, because there is no command to make it invisible. Once it is switched to visible, it remains visible. I suggest to move your condition lines to the Form_Current event - and narrow them down to one line:
Code:
Private Sub Form_Current()

    Me.txtDateComp.Visible = IsNull(Me.txtDateComp)
    
End Sub
moved to current as you instructed.
Best results so far, but here is the problem I am having now. It will switch from visibabe to hide on the correct, records such as visable on the null dates (which is what I need) and hide on the records with dates in the (txtDateComp) field. However, it only works from the last record to the first. From first to last it doesn't work.
 

Users who are viewing this thread

Back
Top Bottom