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

refresh the form

Status
Not open for further replies.

DirtDawg

IS-IT--Management
Apr 17, 2002
218
JP
Hello,

I am importing information from excel into a table. I have a form with a combo box linked to the table. the combo box is linked to a text box by using afterupdate. But, when I import the records, the text box is not updating, the text box is not on the records I am importing, but the combo box is. I would like to have the text box auto update after I import the records, without having to click on each reocord. any ideas?
 
Hi

By linked I assume you mean that the after update event of the combo contain code like txtBox = cboBox ?

If yes, populating the table to which the combo is bound, does not cause the after update event to fire, you need to put you code after the Do.Cmd.TransferSpreadsheet, or whatever you are using to populate the table.

Hope this helps
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
I have tried what you have suggested. It did not work. I have table1 that I import excel to. I have a form1 that uses only 1/3 of the imported excel file. form1 I have a combo1 that is linked to table2. Combo1 has 2columns code and name. If I manully change the combo1 it updates text1. Now when I import the Excel file it fills in combo1 information for me, it does not contain text1 info. So I need to know if after importing to table1 and combo1 is filled in, how to get text1 updated? The records imported are 10000 per week, but deleted on fridays.
 
HI

Could you clarify the code you are using to import the data?

Also after the txtBox = cboBox , did you put a dpevents to cause Access to release resource to fresh screen? Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
import code
Private Sub import_Click()

Dim strfile As String
Dim actgtrp As String
strfile = ("" & xls_file & "")

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "equipment", strfile, True, Sheet1$
actgrp = DLookup("actgrp", "act", "act1 = '&[act1]&'")
end sub


for text box update

Private Sub act1_AfterUpdate()
actgrp = act1.Column(2)
Me.DataChange.refresh
End Sub
 
Hi

Do you have confusion between a control (ie Global within the form) and and a local variable?

Private Sub import_Click()

Dim strfile As String
Dim actgtrp As String <--- local variable
strfile = (&quot;&quot; & xls_file & &quot;&quot;)

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, &quot;equipment&quot;, strfile, True, Sheet1$
actgrp = DLookup(&quot;actgrp&quot;, &quot;act&quot;, &quot;act1 = '&[act1]&'&quot;)
end sub


for text box update

Private Sub act1_AfterUpdate()
actgrp = act1.Column(2) <---- Control
Me.DataChange.refresh
End Sub Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
There is no confusion in the program just me. Everything I hae tried is not working on the updating.
 
Hi

No, I too was confused, very similarly named variable, but not the same!!

what is the purpose of line


actgrp = DLookup(&quot;actgrp&quot;, &quot;act&quot;, &quot;act1 = '&[act1]&'&quot;)

it does not get used?
Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
That is on the my importing form. I was told by some other techs to try that.

But it is not working.
 
Hi

Have you tried?

Private Sub import_Click()

Dim strfile As String
Dim actgtrp As String
strfile = (&quot;&quot; & xls_file & &quot;&quot;)

DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, &quot;equipment&quot;, strfile, True, Sheet1$
actgrp = DLookup(&quot;actgrp&quot;, &quot;act&quot;, &quot;act1 = '&[act1]&'&quot;)
act1_AfterUpdate
end sub


Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
 
That did not work. import is on one form and the combo is on a seperate form.

If yu have any suggestion or need more info please let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top