Populating unbound using current record

S

Stu

Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
S

Stu

Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


Damon Heron said:
Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Stu said:
Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
C

Cheese_whiz

Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

Stu said:
Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


Damon Heron said:
Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Stu said:
Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
D

Douglas J. Steele

Looks to me as though Stu is getting the name of the field and the name of
the table (or query) from controls on his form.

If that's the case, his code is correct, and there must be something else
causing the error.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Cheese_whiz said:
Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in
terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to
troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

Stu said:
Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button
click
event.


Damon Heron said:
Don't have your tables in front of me, but the syntax for dlookup is
field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Trying to populate an unbound field using continuous forms when the
form
opens. I have the following in the ControlSource of the unbound
field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " &
Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated.
(Also got
on error when attempting VBA code in the On Current event)
 
S

Stu

Again, I don't think the problem is syntax as the following statement works
fine with the Button Click event:
Me.CurrentValue = DLookup("[" & Me.audField & "]", Me.audTable, "CourseID =
" & Me.recordID)

The brackets are needed because Me.audField may have a space in it.

I did try the Forms![formname]![fieldname] format and the result is still
the error: #Name?
My guess is that I'm trying to ControlSource the field before other field
values are actually there. Any other thoughts?


Cheese_whiz said:
Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

Stu said:
Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


Damon Heron said:
Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
C

Cheese_whiz

Hi Stu,

Sorry bought that.

Did you try adding that .text property to your form control names? You may
need that if they aren't already committed values...

CW

Stu said:
Again, I don't think the problem is syntax as the following statement works
fine with the Button Click event:
Me.CurrentValue = DLookup("[" & Me.audField & "]", Me.audTable, "CourseID =
" & Me.recordID)

The brackets are needed because Me.audField may have a space in it.

I did try the Forms![formname]![fieldname] format and the result is still
the error: #Name?
My guess is that I'm trying to ControlSource the field before other field
values are actually there. Any other thoughts?


Cheese_whiz said:
Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

Stu said:
Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


:

Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
S

Stu

Let me make this queston simpler. If I put "=me.audfield" in the
controlSource for the unbound field, I still get an error #Name? in the
unbound field. And yes, me.audfield refers to a bound field on the form.
How can I populate the unbound field by using fields on the form at startup?


Stu said:
Again, I don't think the problem is syntax as the following statement works
fine with the Button Click event:
Me.CurrentValue = DLookup("[" & Me.audField & "]", Me.audTable, "CourseID =
" & Me.recordID)

The brackets are needed because Me.audField may have a space in it.

I did try the Forms![formname]![fieldname] format and the result is still
the error: #Name?
My guess is that I'm trying to ControlSource the field before other field
values are actually there. Any other thoughts?


Cheese_whiz said:
Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

Stu said:
Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


:

Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
S

Stu

Yes still getting the error #Name?

Cheese_whiz said:
Hi Stu,

Sorry bought that.

Did you try adding that .text property to your form control names? You may
need that if they aren't already committed values...

CW

Stu said:
Again, I don't think the problem is syntax as the following statement works
fine with the Button Click event:
Me.CurrentValue = DLookup("[" & Me.audField & "]", Me.audTable, "CourseID =
" & Me.recordID)

The brackets are needed because Me.audField may have a space in it.

I did try the Forms![formname]![fieldname] format and the result is still
the error: #Name?
My guess is that I'm trying to ControlSource the field before other field
values are actually there. Any other thoughts?


Cheese_whiz said:
Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

:

Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


:

Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
C

Cheese_whiz

Stu,

If you use the form's current event, it should work. Unless I'm still
confused, then it works for me...

CW

Stu said:
Let me make this queston simpler. If I put "=me.audfield" in the
controlSource for the unbound field, I still get an error #Name? in the
unbound field. And yes, me.audfield refers to a bound field on the form.
How can I populate the unbound field by using fields on the form at startup?


Stu said:
Again, I don't think the problem is syntax as the following statement works
fine with the Button Click event:
Me.CurrentValue = DLookup("[" & Me.audField & "]", Me.audTable, "CourseID =
" & Me.recordID)

The brackets are needed because Me.audField may have a space in it.

I did try the Forms![formname]![fieldname] format and the result is still
the error: #Name?
My guess is that I'm trying to ControlSource the field before other field
values are actually there. Any other thoughts?


Cheese_whiz said:
Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

:

Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


:

Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
S

Stu

That didn't work form me on the form in question, BUT it does work on another
"test" form at least to some extent. I will work with that for a bit and
close this. Thanks for everyone's assistance.

Stu

Cheese_whiz said:
Stu,

If you use the form's current event, it should work. Unless I'm still
confused, then it works for me...

CW

Stu said:
Let me make this queston simpler. If I put "=me.audfield" in the
controlSource for the unbound field, I still get an error #Name? in the
unbound field. And yes, me.audfield refers to a bound field on the form.
How can I populate the unbound field by using fields on the form at startup?


Stu said:
Again, I don't think the problem is syntax as the following statement works
fine with the Button Click event:
Me.CurrentValue = DLookup("[" & Me.audField & "]", Me.audTable, "CourseID =
" & Me.recordID)

The brackets are needed because Me.audField may have a space in it.

I did try the Forms![formname]![fieldname] format and the result is still
the error: #Name?
My guess is that I'm trying to ControlSource the field before other field
values are actually there. Any other thoughts?


:

Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

:

Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


:

Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 
C

Cheese_whiz

Stu,

Feel like I did you a disservice on this one. My apologies, and hope you
get it all worked out!

<sheepishly>
CW

Stu said:
That didn't work form me on the form in question, BUT it does work on another
"test" form at least to some extent. I will work with that for a bit and
close this. Thanks for everyone's assistance.

Stu

Cheese_whiz said:
Stu,

If you use the form's current event, it should work. Unless I'm still
confused, then it works for me...

CW

Stu said:
Let me make this queston simpler. If I put "=me.audfield" in the
controlSource for the unbound field, I still get an error #Name? in the
unbound field. And yes, me.audfield refers to a bound field on the form.
How can I populate the unbound field by using fields on the form at startup?


:

Again, I don't think the problem is syntax as the following statement works
fine with the Button Click event:
Me.CurrentValue = DLookup("[" & Me.audField & "]", Me.audTable, "CourseID =
" & Me.recordID)

The brackets are needed because Me.audField may have a space in it.

I did try the Forms![formname]![fieldname] format and the result is still
the error: #Name?
My guess is that I'm trying to ControlSource the field before other field
values are actually there. Any other thoughts?


:

Hi stu,

Check this out:

http://www.techonthenet.com/access/functions/domain/dlookup.php

You aren't going to find the 'Me' reference in any of the examples in terms
of the field argument, and I've never seen it done before. I'm not saying
it's definitely wrong....but I'd change it if I were trying to troubleshoot
it.

You also have done the brackets in the field argument in an odd way I've
never seen. I would just do them the way this link does them.

At worst, it's another link you can add to your collection :)

HTH,
CW

:

Yes, field name is: Me.audField (with brackets added)
table name is: Me.audTable
I don't think the problem is syntax as I have tested it with a button click
event.


:

Don't have your tables in front of me, but the syntax for dlookup is field,
table, criteria:

=DLookUp(" Field in table ", "TheTable", "CourseID = " & Me.recordID)

Damon


Trying to populate an unbound field using continuous forms when the form
opens. I have the following in the ControlSource of the unbound field:

=DLookUp("[" & Me.audField & "]",Me.audTable,"CourseID = " & Me.recordID)

Getting #Name? error in the unbound field.
Any help on getting the unbound field populated is appreciated. (Also got
on error when attempting VBA code in the On Current event)
 

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