A
Angi
Long and short, if the ship to recordset is empty, the user needs to be
able to click a button and fill the ship to info with the same company
info. The only way I could think to do this is with SQL. It's ugly
coding, so if anyone knows a better idea, I'm all ears! The problem is
it says I'm going to append 0 records to the ShipToMain table when it
should be 1. I've looked at the code, it makes perfect logical sense
to me, so I need a new pair of eyes.
Note: The Select is the only thing I see that could be a problem.
It's not all the table fields, but when I add ShipToMain.*, I get the
error that I have too many CoID destinations. If change the SELECT to
ShipToMain.* and nothing else I still get the 0 record error.
DoCmd.RunSQL "INSERT INTO ShipToMain " _
& "SELECT ShipToMain.CoID, ShipToMain.ShipToName,
ShipToMain.SAddress1, ShipToMain.SAddress2, ShipToMain.SCity,
ShipToMain.SState, ShipToMain.SZip, ShipToMain.SPhone, ShipToMain.SFax
" _
& "FROM ShipToMain WHERE
(((ShipToMain.CoID)=[Forms]![CompanyMain]![CoID]) AND
((ShipToMain.ShipToName)=[Forms]![CompanyMain]![CompanyName]) AND
((ShipToMain.SAddress1)=[Forms]![CompanyMain]![Address1]) AND
((ShipToMain.SAddress2)=[Forms]![CompanyMain]![Address2]) AND
((ShipToMain.SCity)=[Forms]![CompanyMain]![City]) AND
((ShipToMain.SState)=[Forms]![CompanyMain]![State]) AND
((ShipToMain.SZip)=[Forms]![CompanyMain]![Zip]) AND
((ShipToMain.SPhone)=[Forms]![CompanyMain]![Phone]) AND
((ShipToMain.SFax)=[Forms]![CompanyMain]![Fax]));"
able to click a button and fill the ship to info with the same company
info. The only way I could think to do this is with SQL. It's ugly
coding, so if anyone knows a better idea, I'm all ears! The problem is
it says I'm going to append 0 records to the ShipToMain table when it
should be 1. I've looked at the code, it makes perfect logical sense
to me, so I need a new pair of eyes.
Note: The Select is the only thing I see that could be a problem.
It's not all the table fields, but when I add ShipToMain.*, I get the
error that I have too many CoID destinations. If change the SELECT to
ShipToMain.* and nothing else I still get the 0 record error.
DoCmd.RunSQL "INSERT INTO ShipToMain " _
& "SELECT ShipToMain.CoID, ShipToMain.ShipToName,
ShipToMain.SAddress1, ShipToMain.SAddress2, ShipToMain.SCity,
ShipToMain.SState, ShipToMain.SZip, ShipToMain.SPhone, ShipToMain.SFax
" _
& "FROM ShipToMain WHERE
(((ShipToMain.CoID)=[Forms]![CompanyMain]![CoID]) AND
((ShipToMain.ShipToName)=[Forms]![CompanyMain]![CompanyName]) AND
((ShipToMain.SAddress1)=[Forms]![CompanyMain]![Address1]) AND
((ShipToMain.SAddress2)=[Forms]![CompanyMain]![Address2]) AND
((ShipToMain.SCity)=[Forms]![CompanyMain]![City]) AND
((ShipToMain.SState)=[Forms]![CompanyMain]![State]) AND
((ShipToMain.SZip)=[Forms]![CompanyMain]![Zip]) AND
((ShipToMain.SPhone)=[Forms]![CompanyMain]![Phone]) AND
((ShipToMain.SFax)=[Forms]![CompanyMain]![Fax]));"