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

If... Then statement to populate table data

Status
Not open for further replies.

rushmore

Technical User
Jul 18, 2000
3
US
I am a novice user of Microsoft Access 97 and am trying to use a conditional statement to populate a series of tables based on information in a &quot;master&quot; table.&nbsp;&nbsp;<br><br>I used the expression builder to create the following if... then statement.&nbsp;&nbsp;When I run the procedure an external name not defined compile error is returned. <br><br>Option Compare Database<br>Option Explicit<br><br>Public Sub map()<br><br>If [table1]![field1] Like &quot;*BILL*&quot; And [table1]![field2] = &quot;USTR&quot; Then<br>&nbsp;&nbsp;&nbsp;&nbsp;[table2]![field1] = &quot;MATURITY&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table2]![field2] = &quot;&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table3]![field1] = &quot;ZEROCPN&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table3]![field2] = &quot;ZEROCPN&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table4]![field1] = &quot;ZEROCPN&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table5]![field1] = &quot;United States Treasury Bill&quot; & [table1]![field3]<br>&nbsp;&nbsp;&nbsp;&nbsp;[table6]![field1] = &quot;MM&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table6]![field2] = &quot;BILL&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table6]![field3] = &quot;GOVT&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table6]![field4] = &quot;USTNOTE&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;[table7]![field1] = &quot;S&quot;<br>End If<br>End Sub<br><br>The goal is to populate table data with the strings in the above code.&nbsp;&nbsp;Table1 is the master table and the others are the recipients of master data when the conditions are met.<br>All the tables have been defined<br><br><br>I really don't think the above code syntax is correct.&nbsp;&nbsp;If anyone could provide me with any tips to point me in the right I would be very grateful.&nbsp;&nbsp;Thanks in advance.<br><br><br><br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top