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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing field in table with command button

Status
Not open for further replies.
Aug 24, 2005
56
US
Hello All,

I have a form (form1) that pulls data from a table (table1).

I also have a second form (form2) that has several command buttons.

Form1 and Form2 are not related in any way and no relationship can be established.

Table 1 only has 6 records, and each command button in form2 is supposed to access one of these records.

Is there anyway to code in VB so that [table1]![column1] = "(desired record)" for each of the command buttons?

This would mean that when each command button when pressed, pulls up form1 with just the desired record showing.

Thanks for any help in advance,

Cordeiro82
 
Well, however you would differentiate
between the records (primary Key),
will give you the key

cmdButton1_Click()
Docmd.OpenForm "frmForm1",,,"pkID = 1"
End Sub

cmdButton2_Click()
Docmd.OpenForm "frmForm1",,,"pkID = 2"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top