Combo box value disappears


N

Nathan

Using Acess 2003.

I have a form with a subform attached. The combo box is on the main form,
however. I've added this combo box bound to a new field in the database
called CLPL. I have the combo box set up to use a value list of either C, P
or nothing. The user is creating a brand new record with this form. When I
fill in the form, the combo box value populates correctly.

I have used the generic save record button fron the toolbar. The user of
the form needs to be able to save the record, but stay in the form, so this
is the best option.

The problem is that with the new combo box, when I hit the save record
button, the value in the combo box disappears THE FIRST TIME. Once the
record is saved once, I can repopulate the combo box, hit the save record
button, and then it DOES save. Thats no good, but I can't seem to figure out
how to get the combo box field to work on the first iteration. Any
suggestions?
 
Ad

Advertisements

P

PJFry

Generally speaking, you shouldn't need to 'save' and record. The default
setting is to allow real-time saving of the record.

Make sure that the Control Source is set to accept the value that you
putting into the combo box.

If you use the wizard to set up the combo box, it should give you the option
of saving the value in a field on your table. If nothing else, delete the
combo box and re-add it.
 
N

Nathan

Well, its a data entry form, so I have to do something to advance the form so
that the record appears in the table. If I just fill in the form then close
out, the record does now show up. So I figured using the default save record
code would work, and it has, up til now.

The control source is set the CLPL field in the table, which is text, and I
am trying to pass either a C or P from the combo box.

Everything in the properties of the combo box appears fine - I deleted it a
readded it using the wizard - same result.
 
N

Nathan

Incidentally, this is the code that is generated when I insert the 'save
record' button. I'm not sure what all of these things mean, so perhaps the
problem lies here somewhere? Anyone know what these commands are?

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
 
N

Nathan

Ok, nix my last post, this code isn't the problem.

I tried something new - I filled in the form, then rather than hitting the
save record button, I just clicked in the subform. The record saved, but
again, the value I had the combo box cleared out. So SOMETHING is happening
when the record is created in the table that is causing it not to accept any
value from that one particular combo box.

Once the record is created, I can then add a value into the combo box,
re-save the record, and it works fine.... Its maddening. Any ideas?
 
Ad

Advertisements

P

PJFry

First, check the record source for your form. Make sure that the
recordsource for the form includes the value that your are saving the combo
box to.

Once you have confirmed that your form recordsource contains the field you
are saving to, confirm that your Control Source for the combo box is that
field.

Now, when you say the combo box 'cleared out', are you saying that when you
clicked into the subform, the value in the combo disappeared right then? Or
did you need to move out and back into that record?

--
Regards,

PJ
Please rate this post using the vote buttons if it was helpful.
 
Ad

Advertisements


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