Auto Populate a Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
In both cases, use the After Update event of the check box and the combo box.

Me.MyDateControl = DateAdd("d", 30, Date) 'For the Checkbox

Me.MyDateControl = DateAdd("d", 7, Date) 'For the Combo
 
Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!
 
Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?
 
What is the error message?

Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

Jeff L said:
Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!
 
i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

Jeff L said:
What is the error message?

Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

Jeff L said:
Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
Do you have a break point in there? In the code window, click debug,
clear all breakpoints. Run your code again.

If it stops again, post the line that it breaks on.

i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

Jeff L said:
What is the error message?

Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

:

Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
Me.[Complaint Reason Codes].Locked = True

Jeff L said:
Do you have a break point in there? In the code window, click debug,
clear all breakpoints. Run your code again.

If it stops again, post the line that it breaks on.

i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

Jeff L said:
What is the error message?


WMorsberger wrote:
Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

:

Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
What is [Complaint Reason Codes]?

It seems to me like your controls in the code are not matching up. You
have 3 controls in the code, but in your original post you have a check
box for compliments and a drop down list for complaints.

Here is what your code should look like. I am calling the checkbox
Compliment. I am calling the dropdown Complaint. If you called them
different names then use those.

For the checkbox:

If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.Complaint.Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If

For the dropdown:

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub

Me.[Complaint Reason Codes].Locked = True

Jeff L said:
Do you have a break point in there? In the code window, click debug,
clear all breakpoints. Run your code again.

If it stops again, post the line that it breaks on.

i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

:

What is the error message?


WMorsberger wrote:
Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

:

Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
I got the Compliment checkbox to work but I am having a problem with the
complaint reason codes

When i choose from the drop down box I get an error message that reads
"Runtime Error '13'
type mismatch

Then if I press debug it takes me to the VB screen and the first line of the
code is highlighted.

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub

Jeff L said:
What is [Complaint Reason Codes]?

It seems to me like your controls in the code are not matching up. You
have 3 controls in the code, but in your original post you have a check
box for compliments and a drop down list for complaints.

Here is what your code should look like. I am calling the checkbox
Compliment. I am calling the dropdown Complaint. If you called them
different names then use those.

For the checkbox:

If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.Complaint.Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If

For the dropdown:

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub

Me.[Complaint Reason Codes].Locked = True

Jeff L said:
Do you have a break point in there? In the code window, click debug,
clear all breakpoints. Run your code again.

If it stops again, post the line that it breaks on.


WMorsberger wrote:
i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

:

What is the error message?


WMorsberger wrote:
Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

:

Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
Is Complaint the name of your drop down list? If not then you need to
change it to the name you called it, otherwise it should work. You
could also try IsNull instead of Nz.

I got the Compliment checkbox to work but I am having a problem with the
complaint reason codes

When i choose from the drop down box I get an error message that reads
"Runtime Error '13'
type mismatch

Then if I press debug it takes me to the VB screen and the first line of the
code is highlighted.

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub

Jeff L said:
What is [Complaint Reason Codes]?

It seems to me like your controls in the code are not matching up. You
have 3 controls in the code, but in your original post you have a check
box for compliments and a drop down list for complaints.

Here is what your code should look like. I am calling the checkbox
Compliment. I am calling the dropdown Complaint. If you called them
different names then use those.

For the checkbox:

If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.Complaint.Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If

For the dropdown:

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub

Me.[Complaint Reason Codes].Locked = True

:

Do you have a break point in there? In the code window, click debug,
clear all breakpoints. Run your code again.

If it stops again, post the line that it breaks on.


WMorsberger wrote:
i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

:

What is the error message?


WMorsberger wrote:
Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

:

Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
Hey Jeff

Complaint is the name of my drop down list but it is still not auto
populating anything. When I leave the Nz I receive the runtime error, but
when I change it to IsNull I don't get anything - no error message but it
still is not populating the resolve date - is there anything else I can try?

Jeff L said:
Is Complaint the name of your drop down list? If not then you need to
change it to the name you called it, otherwise it should work. You
could also try IsNull instead of Nz.

I got the Compliment checkbox to work but I am having a problem with the
complaint reason codes

When i choose from the drop down box I get an error message that reads
"Runtime Error '13'
type mismatch

Then if I press debug it takes me to the VB screen and the first line of the
code is highlighted.

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub

Jeff L said:
What is [Complaint Reason Codes]?

It seems to me like your controls in the code are not matching up. You
have 3 controls in the code, but in your original post you have a check
box for compliments and a drop down list for complaints.

Here is what your code should look like. I am calling the checkbox
Compliment. I am calling the dropdown Complaint. If you called them
different names then use those.

For the checkbox:

If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.Complaint.Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If

For the dropdown:

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub


WMorsberger wrote:
Me.[Complaint Reason Codes].Locked = True

:

Do you have a break point in there? In the code window, click debug,
clear all breakpoints. Run your code again.

If it stops again, post the line that it breaks on.


WMorsberger wrote:
i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

:

What is the error message?


WMorsberger wrote:
Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

:

Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
Try
If Not IsNull(Me.Complaint) Then

Hey Jeff

Complaint is the name of my drop down list but it is still not auto
populating anything. When I leave the Nz I receive the runtime error, but
when I change it to IsNull I don't get anything - no error message but it
still is not populating the resolve date - is there anything else I can try?

Jeff L said:
Is Complaint the name of your drop down list? If not then you need to
change it to the name you called it, otherwise it should work. You
could also try IsNull instead of Nz.

I got the Compliment checkbox to work but I am having a problem with the
complaint reason codes

When i choose from the drop down box I get an error message that reads
"Runtime Error '13'
type mismatch

Then if I press debug it takes me to the VB screen and the first line of the
code is highlighted.

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub

:

What is [Complaint Reason Codes]?

It seems to me like your controls in the code are not matching up. You
have 3 controls in the code, but in your original post you have a check
box for compliments and a drop down list for complaints.

Here is what your code should look like. I am calling the checkbox
Compliment. I am calling the dropdown Complaint. If you called them
different names then use those.

For the checkbox:

If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.Complaint.Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If

For the dropdown:

If Nz(Me.Complaint) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.Compliment.Locked = False
End If
End Sub


WMorsberger wrote:
Me.[Complaint Reason Codes].Locked = True

:

Do you have a break point in there? In the code window, click debug,
clear all breakpoints. Run your code again.

If it stops again, post the line that it breaks on.


WMorsberger wrote:
i don't get an error message, it just opens up the VB window and highlights
the .locked portion of the code.

:

What is the error message?


WMorsberger wrote:
Here is what I have in the after update

Private Sub Complaint_AfterUpdate()
If Nz(Me.[Complaint Reason Codes]) Then
Me.Resolve_Date = Date + 7
Me.Compliment.Locked = True
Else
Me.Resolve_Date = Null
Me.[Complaint Reason Codes].Locked = False
End If
End Sub

Private Sub Compliment_AfterUpdate()
If Me.Compliment = True Then
Me.Resolve_Date = Date + 30
Me.[Complaint Reason Codes].Locked = True
Else
Me.Resolve_Date = Null
Me.Complaint.Locked = False
End If
End Sub

On both the compliment and the complaint I am getting an error message in
regards to the .Locked part.

What am I doing wrong?

:

Yes. Use an On Update event. You will probably want to disable the
other control as well. You don't want a compliment and complaint at
the same time.

If Me.Compliment = True then
Me.DateFieldName = Date + 30
Me.Complaint.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

For the other one

If Nz(Me.Complaint) then
Me.DateFieldName = Date + 7
Me.Compliment.Locked = True
Else
Me.DateFieldName = Null
Me.Complaint.Locked = False
End IF

Hope that helps!




WMorsberger wrote:
I have a date box that I need to have auto populate depending on whether a
check box is check or whether something is choosen out of a drop down box.
Example, If the compliment box is checked then I need the date to auto
populate with a date that is 30 days from today - and if an option is chosen
out of the complaint drop down box then I need for the date to auto populate
with a date that is 7 days from today.

Is this possible?
 
Back
Top