Creating froms based on AutoLookup

G

Guest

I have created an autolookup query based on two tables (AcctCodes and Batches).

In the query when I enter a value the Account Code field, the Description
field is automatically updated.

Question: How do I create a from based on this? Form has two fields: Code
and Description. When I enter a value in the Code field, the Description
should auto-change

Thanks
 
G

Guest

After retrieving the value do you want the ability to update this records, or
just view the values?
If all you want is to view the records, then on the ControlSource Property
of the Description field write a dlookup function
=dlookup("Description","QueryName","[Account Code] = " &
forms![FormName]![FieldName] ) ' incase the Account Code type is number
or
=dlookup("Description","QueryName","[Account Code] = '" &
forms![FormName]![FieldName] & "'" ) ' incase the Account Code type is Text
 
G

Guest

Thanks Ofer,

I have done as u suggested. However, no matter the value I put in the
Account Codes field, the Descirption shows the very first Description in the
table, ie Description record 1.

What am I doing wrong? The Account Codes field is a number

Ofer said:
After retrieving the value do you want the ability to update this records, or
just view the values?
If all you want is to view the records, then on the ControlSource Property
of the Description field write a dlookup function
=dlookup("Description","QueryName","[Account Code] = " &
forms![FormName]![FieldName] ) ' incase the Account Code type is number
or
=dlookup("Description","QueryName","[Account Code] = '" &
forms![FormName]![FieldName] & "'" ) ' incase the Account Code type is Text

chessMaster said:
I have created an autolookup query based on two tables (AcctCodes and Batches).

In the query when I enter a value the Account Code field, the Description
field is automatically updated.

Question: How do I create a from based on this? Form has two fields: Code
and Description. When I enter a value in the Code field, the Description
should auto-change

Thanks
 
O

Ofer via AccessMonster.com

Can you post the dlookup code you created, and where did you create it.
 
G

Guest

Here is the code:

=dlookup("Description","acctCodeLookup","[txtacctCodes] = " &
forms![BatchTest]![txtacctCodes]

i. the acctCodeLookup query has two fields - AcctCodes and Description

ii. the form's fileds include txtacctCodes (for user to enter the Account
Code) and txtDescription (this ideally should lookup the code description
based on value in txtacctCodes)

Thanks,
 
G

Guest

I placed the codes in the ControlSource of the txtacctDescription.


chessMaster said:
Here is the code:

=dlookup("Description","acctCodeLookup","[txtacctCodes] = " &
forms![BatchTest]![txtacctCodes]

i. the acctCodeLookup query has two fields - AcctCodes and Description

ii. the form's fileds include txtacctCodes (for user to enter the Account
Code) and txtDescription (this ideally should lookup the code description
based on value in txtacctCodes)

Thanks,


Ofer via AccessMonster.com said:
Can you post the dlookup code you created, and where did you create it.
 
G

Guest

So from you wrote the field in the query called AcctCodes , in that case the
dlookup should be

=dlookup("Description","acctCodeLookup","AcctCodes = " &
forms![BatchTest]![txtacctCodes]



chessMaster said:
I placed the codes in the ControlSource of the txtacctDescription.


chessMaster said:
Here is the code:

=dlookup("Description","acctCodeLookup","[txtacctCodes] = " &
forms![BatchTest]![txtacctCodes]

i. the acctCodeLookup query has two fields - AcctCodes and Description

ii. the form's fileds include txtacctCodes (for user to enter the Account
Code) and txtDescription (this ideally should lookup the code description
based on value in txtacctCodes)

Thanks,


Ofer via AccessMonster.com said:
Can you post the dlookup code you created, and where did you create it.
 
G

Guest

THANK YOU, Ofer. It works!!!


Ofer said:
So from you wrote the field in the query called AcctCodes , in that case the
dlookup should be

=dlookup("Description","acctCodeLookup","AcctCodes = " &
forms![BatchTest]![txtacctCodes]



chessMaster said:
I placed the codes in the ControlSource of the txtacctDescription.


chessMaster said:
Here is the code:

=dlookup("Description","acctCodeLookup","[txtacctCodes] = " &
forms![BatchTest]![txtacctCodes]

i. the acctCodeLookup query has two fields - AcctCodes and Description

ii. the form's fileds include txtacctCodes (for user to enter the Account
Code) and txtDescription (this ideally should lookup the code description
based on value in txtacctCodes)

Thanks,


:

Can you post the dlookup code you created, and where did you create it.
 

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