Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

replacement for another table

Status
Not open for further replies.

delpino

Programmer
Dec 29, 2000
17
0
0
GB
Hi..

i have got a table which has two fields:

group_number
group_description

now when i type data into group_number it should fill in the information of group_description which is associated to group_number. the information which group_number belongs to which group_description is stored in another table.

the association between group_number and group_description looks like this for example ...

group_number: 001
group_description: Great Britain

group_number: 002
group_description: Lady Diana

etc...

so anyone know how to do that replacement?
 
Well you have to have that data in a table some where to start with.

So you need a table with this
Table1
group_number group_description
001 Great Britain
002 Lady Diana

then you could make a query that would find 002 and return
"Lady Diana"

dim db as database, rst as recordset, SQL, MyValue as String
SQL = "Select * From Table1 Where group_number = '002'"
set db = currentdb
set rst = db.openrecordset(SQL)
MyValue = rst!group_description
' So Lady Diana would end up in MyValue
rst.close
db.close

DougP, MCP

Visit my WEB site to see how Bar-codes can help you be more productive
 
This looks more like a piece of VB code than a query..could you go into more detail as to where to put this piece of code?

sorry fairly new to access programming..
 
I have succeeded doing it like this:

Private Sub Text38_AfterUpdate()

Dim number_in_form, desc_in_form As String

number_in_form = Forms![lots].group_number

desc_in_form = DLookup("[group_description]", "[list_of_groups]", "[group_number] = '" & number_in_form & "' ")

Forms![lots].group_description = desc_in_form

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top