If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Tables and Forms.
In Access2000 is it possible to refer to a field in a table from a form with
which it is not linked. For example I have tables Tab1 and Tab2 and I have a form frmMain and its Record Source property is set to Tab1. Can I access a record from Tab2 onto a textbox on frmMain. Thanks |
#2
|
|||
|
|||
Farooq,
You have a couple of options: 1. Using DLookup() Me!txtMyTextbox = DLookup("[myfield]", "Tab2", "field1 = 123") the "field = 123" part means "WHERE field = 123" 2. Using a recordset Dim db As Database Dim rs As DAO.Recordset Dim sSQL As String Set db = CurentDb sSQL = "SELECT myfield FROM Tab2 WHERE field = 123" Set rs = db.OpenRecordset(sSQL, dbOpenSnapshot) If rs.AbsolutePosition -1 Then Me!txtMyTextBox = rs!myfield End If rs.Close Set rs = Nothing Set db = Nothing Regards, Graham R Seach Microsoft Access MVP Sydney, Australia --------------------------- "Farooq Sheri" wrote in message ... In Access2000 is it possible to refer to a field in a table from a form with which it is not linked. For example I have tables Tab1 and Tab2 and I have a form frmMain and its Record Source property is set to Tab1. Can I access a record from Tab2 onto a textbox on frmMain. Thanks |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
creating forms with more then three tables | Mick | New Users | 5 | August 18th, 2004 06:04 PM |
Query-based forms with multiple tables | Andrew Parker | Using Forms | 1 | August 18th, 2004 01:49 AM |
Tables and Tabular Forms | ecc28 | Database Design | 0 | May 24th, 2004 06:54 AM |