default by user input - repost

H

Heather

Okay, I'm stumped

I have frmDefaultProvider with field ProviderID

I have frmServices with field ProviderID, which has a
default value set to

=[Forms]![frmDefaultProvider]![ProviderID]

I've used this expression many times before, always
successfully. Now I'm getting the #name? error. Both
data types are set to Long Integer.

Any ideas please?

Thanks!

Heather
 
W

Wayne Morgan

Do you have a control also called ProviderID, perhaps the textbox used for
the field ProviderID? If so, rename the textbox to txtProviderID, Access
doesn't know which of the two object (field or textbox) that you want the
value from.
 
G

Guest

Thanks Wayne, I changed the name of one of the controls
(they were in fact the same) and I'm still getting the
error. I don't understand :-(

Heather

-----Original Message-----
Do you have a control also called ProviderID, perhaps the textbox used for
the field ProviderID? If so, rename the textbox to txtProviderID, Access
doesn't know which of the two object (field or textbox) that you want the
value from.

--
Wayne Morgan
MS Access MVP


Okay, I'm stumped

I have frmDefaultProvider with field ProviderID

I have frmServices with field ProviderID, which has a
default value set to

=[Forms]![frmDefaultProvider]![ProviderID]

I've used this expression many times before, always
successfully. Now I'm getting the #name? error. Both
data types are set to Long Integer.

Any ideas please?

Thanks!

Heather


.
 
W

Wayne Morgan

Try changing the line to refer to the control, not the field:

=[Forms]![frmDefaultProvider]![txtProviderID]
 
H

Heather

Okay, I did that; the control was the same name as the
field, it is now different. So now, the error message is
gone, but the default did not transfer...the field is
blank. I am using a combo box on both forms with exactly
the same properties except the default....

How can this not be working?

Heather

-----Original Message-----
Try changing the line to refer to the control, not the field:

=[Forms]![frmDefaultProvider]![txtProviderID]


--
Wayne Morgan
MS Access MVP


Thanks Wayne, I changed the name of one of the controls
(they were in fact the same) and I'm still getting the
error. I don't understand :-(


.
 
W

Wayne Morgan

The default value is only for new records and the value would have to exist
on the other form before you move to the new record or open the form if the
first record is a new one. I just checked and it does work. If you are
checking it going back and forth between design view and normal view, try
closing the form and reopening it instead.
 
H

Heather

THanks Wayne, I guess I'm going to have to come up with
another plan, it's still not working. I've done this
before, so I understand how it works, but I don't get
what's wrong. Is there code I could use instead
on 'after update' or something?

Heather
 
W

Wayne Morgan

In the Form's Current event you could try something similar to:

If Me.NewRecord Then
Me.txtMyTextbox = Forms!frmMyForm!txtMyOtherTextbox
End If
 
W

Wayne Morgan

ps, what happens if you leave the equal sign out of the expression typed
into the Default Value box?
 

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