run time error 424

D

davant

I need help trying to figure this one out. I get the runtime error 424
pointing to ..if exceldatable.[company id].... I want to have the
program to check to see if a company id exists in the 2
tables(exceldata and company); if it does, do not add the company id to
the company table(do nothing); if the company id does not exist in the
company table, the program will insert the data from the selected
fields. Where I am going astray?

Thanks for any and all help.

Davant

PROBLEM BEGINS HERE:

If exceldatatable.[company id] = company.companyid Then
exceldatatable.[company id] = company.companyid
Else
CurrentDb.Execute "INSERT INTO Company (companyid)Select DISTINCT
[Company id]FROM ExcelDataTable"
End If

End of problem line


Private Sub cmdProcessExcelFile_Click()
Dim db As DAO.Database
Set db = CurrentDb()

DoCmd.SetWarnings True


CurrentDb.Execute "INSERT INTO Conference ([Conference
ID],[Conference name],[start Date],[Start time],[End time],[Length of
conference],[Conference Price])Select DISTINCT [Conference
ID],[Conference name],[start Date],[Start time],[End time],[Length of
conference],[Conference Price] FROM ExcelDataTable"


CurrentDb.Execute "INSERT INTO Participant
(PLastname,PFirstname,PTelephoneNumber,PEmailAddress,PCompanyid,PCompanyName,[Conference
Id])Select Lastname,Firstname,[phone number],email,[company
id],[company name],[Conference ID]FROM ExcelDataTable WHERE Duplicate
IS Null"

CurrentDb.Execute "INSERT INTO BillingActivity ([Conference
ID],CCtype,Ccnumber,CCExpDate,CCName,CCBillAddress)Select[Conference
ID],[type of credit card],[credit card number],[expiration date],[name
on credit card],[credit card billing address]FROM ExcelDataTable"

DoCmd.SetWarnings True

MsgBox "All done. Now Exit to the Main Menu and click on MSS Forms
and Reports to view the current file that was just downloaded."

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top