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

adding to tables

Status
Not open for further replies.

tonyNZ

Technical User
May 14, 2001
8
NZ
I have 2 identical tables but neither are keyed and can't be as get message tempory file too big when trying to key fields

I want to add one table to another through a form but can't get it to work
it works through the utilities add, and gives me the option to append, any help??
 
Not sure what you mean by "add one table to another through a form ".

Here is the codes you can add to a button on the form to append data from one table to another.

Append data from table1 to table2.

Var
Tbl table
EndVar

if isTable(“table1.db”) then
Tbl.Attach(“table1.db”)
if NOT Tbl.Add(“table2.db”,True,False) then
errorShow()
endIf
else
msgStop("Error", "Can't find " + “table1.db” + ".")
endIf



 
Thanks Joe, that simple huh and here I was beating my head against a brick wall

Have another problem you may hlep with

I have a saved query that is a changeto that works fine

yet when I executeQBEFile through a button on a form it doesn't make the changes in the table

what should i have as teh method in the button apart from the execute command

thanks
 
Hey again Joe

I have figured out it is because the changeto is on dollar values and some of the fields were blank so didn't work unless all fields had a value, have set default in the table to $0.00 and it works but must be an easier way

Funny it works whe you run the query and not through the execute command in a button on a form??
 
tonyNZ,

You could always run a For loop to write "0" or "Blank" into the empty fields depending on if they are numeric or text fields. Just before the executeQBEFile

Something like the code below might suffice

Var
TC TCursor
EndVar

TC.open("YourTable.db")
TC.edit()
tblName = "YourTable.db"
AlTbl.attach(tblName)
end=AlTbl.nRecords()

for i from 1 to end

if TC."YourField".isblank()=True
then TC."YourField"="0"
EndIf

tc.nextRecord() ; move down one record

endFor




Regards

Bystander
 
tonyZ,

Slight adjustment to my earlier post

Var
TC TCursor
end longint
AlTbl Table
EndVar

The rest stays the same.

Apologies

Bystander
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top