Duplicate Field

M

Maurita

Hi, hope someone can help me with the code for a duplicate field. I
found the following code in this forum, Me.Date.DefaultValue = "#" &
[Date] & "#", which works great for the date field that needs to be
duplicated for the next record, but I am having trouble with code where
a combo box (cboTime) has two choices, "Downtime" and "Production".
Once the user chooses either downtime or production, that field needs
to remain the same for the next record until the user chooses the other
option.

I appreciate any help that can be given.

Maurita Searcy
 
K

kingston via AccessMonster.com

Use the AfterUpdate event for cboTime:

Me.cboTime.DefaultValue = Me.cboTime

Hi, hope someone can help me with the code for a duplicate field. I
found the following code in this forum, Me.Date.DefaultValue = "#" &
[Date] & "#", which works great for the date field that needs to be
duplicated for the next record, but I am having trouble with code where
a combo box (cboTime) has two choices, "Downtime" and "Production".
Once the user chooses either downtime or production, that field needs
to remain the same for the next record until the user chooses the other
option.

I appreciate any help that can be given.

Maurita Searcy
 
M

Maurita

Thank you so very much for all your help. I can see where this will
work, but I am having a problem since I am also sending the cursor to
another field depending upon the choice. The cursor is going to the
appropriate field (either cboProduction or cboDowntime), but the choice
of Production or Downtime is not remaining in the cboTime field for the
new record. I have tried the code sent in this e-mail at both the
beginning and end of the following code, but still am having no luck
Please help me understand what I am doing wrong. Thank you so very
much. Maurita

If Me!cboTime = "Production" Then
DoCmd.GoToControl "cboProduction"
ElseIf Me!cboTime = "Downtime" Then
DoCmd.GoToControl "cboDowntime"
End If


Use the AfterUpdate event for cboTime:

Me.cboTime.DefaultValue = Me.cboTime

Hi, hope someone can help me with the code for a duplicate field. I
found the following code in this forum, Me.Date.DefaultValue = "#" &
[Date] & "#", which works great for the date field that needs to be
duplicated for the next record, but I am having trouble with code where
a combo box (cboTime) has two choices, "Downtime" and "Production".
Once the user chooses either downtime or production, that field needs
to remain the same for the next record until the user chooses the other
option.

I appreciate any help that can be given.

Maurita Searcy
 
K

kingston via AccessMonster.com

Sorry, if you're using a text value, you need to enclose it in quotes (just
like you did with a date and #):

Me.cboTime.DefaultValue = "'" & Me.cboTime & "'"
Thank you so very much for all your help. I can see where this will
work, but I am having a problem since I am also sending the cursor to
another field depending upon the choice. The cursor is going to the
appropriate field (either cboProduction or cboDowntime), but the choice
of Production or Downtime is not remaining in the cboTime field for the
new record. I have tried the code sent in this e-mail at both the
beginning and end of the following code, but still am having no luck
Please help me understand what I am doing wrong. Thank you so very
much. Maurita

If Me!cboTime = "Production" Then
DoCmd.GoToControl "cboProduction"
ElseIf Me!cboTime = "Downtime" Then
DoCmd.GoToControl "cboDowntime"
End If
Use the AfterUpdate event for cboTime:
[quoted text clipped - 16 lines]
Message posted via AccessMonster.com
 
M

Maurita

Thank you so very much, the code worked perfectly. I appreciate all
your help.

Maurita
Sorry, if you're using a text value, you need to enclose it in quotes (just
like you did with a date and #):

Me.cboTime.DefaultValue = "'" & Me.cboTime & "'"
Thank you so very much for all your help. I can see where this will
work, but I am having a problem since I am also sending the cursor to
another field depending upon the choice. The cursor is going to the
appropriate field (either cboProduction or cboDowntime), but the choice
of Production or Downtime is not remaining in the cboTime field for the
new record. I have tried the code sent in this e-mail at both the
beginning and end of the following code, but still am having no luck
Please help me understand what I am doing wrong. Thank you so very
much. Maurita

If Me!cboTime = "Production" Then
DoCmd.GoToControl "cboProduction"
ElseIf Me!cboTime = "Downtime" Then
DoCmd.GoToControl "cboDowntime"
End If
Use the AfterUpdate event for cboTime:
[quoted text clipped - 16 lines]
Message posted via AccessMonster.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top