Setting a default value

R

Rosebud

I have a form that contains a control [CourseCategory]. There's another
control [Category] on the same form. For new records, I'd like the value of
Category to default to the value of CourseCategory. I've tried setting the
Default Value property of Category to CourseCategory but that doesn't seem to
work. I read somewhere that this might be because the form doesn't know the
value of CourseCategory until after the update. So I tried using SetValue in
a macro that runs AfterUpdate. No luck there either. This sounds like it
should be simple but I've spent hours on it. Help please! And I'm not a
coder so I'd prefer an answer that doesn't involve writing code. Thanks.
 
K

Klatuu

In the After Update event of CourseCategory, populate Course

Private Sub CourseCategory_AfterUpdate()
Me.Course = Me.CourseCategory
End Sub
 
R

Rosebud

This isn't working. The Course field is still blank after the update. And
wouldn't this reset the value of Course for ALL records? I only want this to
happen on new records as a default value.

Klatuu said:
In the After Update event of CourseCategory, populate Course

Private Sub CourseCategory_AfterUpdate()
Me.Course = Me.CourseCategory
End Sub
--
Dave Hargis, Microsoft Access MVP


Rosebud said:
I have a form that contains a control [CourseCategory]. There's another
control [Category] on the same form. For new records, I'd like the value of
Category to default to the value of CourseCategory. I've tried setting the
Default Value property of Category to CourseCategory but that doesn't seem to
work. I read somewhere that this might be because the form doesn't know the
value of CourseCategory until after the update. So I tried using SetValue in
a macro that runs AfterUpdate. No luck there either. This sounds like it
should be simple but I've spent hours on it. Help please! And I'm not a
coder so I'd prefer an answer that doesn't involve writing code. Thanks.
 
K

Klatuu

I have no idea why this would not work. It is pretty straight forward. It
should only affect the current record. As to trying to set a default value,
since the record is already created by the time you get to this point, it is
too late.

--
Dave Hargis, Microsoft Access MVP


Rosebud said:
This isn't working. The Course field is still blank after the update. And
wouldn't this reset the value of Course for ALL records? I only want this to
happen on new records as a default value.

Klatuu said:
In the After Update event of CourseCategory, populate Course

Private Sub CourseCategory_AfterUpdate()
Me.Course = Me.CourseCategory
End Sub
--
Dave Hargis, Microsoft Access MVP


Rosebud said:
I have a form that contains a control [CourseCategory]. There's another
control [Category] on the same form. For new records, I'd like the value of
Category to default to the value of CourseCategory. I've tried setting the
Default Value property of Category to CourseCategory but that doesn't seem to
work. I read somewhere that this might be because the form doesn't know the
value of CourseCategory until after the update. So I tried using SetValue in
a macro that runs AfterUpdate. No luck there either. This sounds like it
should be simple but I've spent hours on it. Help please! And I'm not a
coder so I'd prefer an answer that doesn't involve writing code. Thanks.
 
J

Jan Baird

Jan Baird is out of the country until September 20. Every effort will be
made to respond to messages, but please be patient.
 

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