Access DB pulling wrong field on click export to excel

Glowie13

New Member
Joined
Sep 14, 2015
Messages
2
In my works microsoft access database I have built a button to export data from a specific form to an excel document. The excel document has it's own calculations built in to pull/distribute the data from the database when the excel document is opened by the click button. As of Friday the code was working perfectly and was pulling everything as expected.

Today when I came in, the button is no longer pulling the field 'Customer #' to the document, it instead duplicates the information from 'Install Customer #' So for instance, a record with the following information:

Customer Name: Glowie
Order #: 1
INSTALL Customer #: 99
Customer #: 100

The above information would pull to excel with the following 4 fields:
A2 = Glowie
B2 = 1
C2 = 99
D2 = 99

The code is as follows in access:

Private Sub Command8_Click()
Dim appExcel As Excel.Application
Dim wrkBook As Excel.Workbook

Set appExcel = New Excel.Application
Set wrkBook = appExcel.Workbooks.Open(CurrentProject.Path & "\Formula.xls")

appExcel.Visible = True

wrkBook.Worksheets("Data").Activate

With wrkBook.ActiveSheet
.Range("A2").Value = [Customer Name]
.Range("B2").Value = [Order #]
.Range("C2").Value = [INSTALL Customer #]
.Range("D2").Value = [Customer #]
.Columns("A:H").AutoFit
End With
End Sub


Please advise why the code would be pulling INSTALL Customer # to C2 and D2.

Thank you!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Appears there is no issue with the code, however at some point in time the Access Form we were using had the Install Customer # text box named 'Customer #' so it was pulling the data from that text box, not the database. Changed the text box name to text0000 and it works fine now.
 
Upvote 0
be sure to SOLVE this tread.
ranman,

I think you are confusing your Forums. We don't have anything like that here!
Just replying like they did is sufficient.
 
Upvote 0

Forum statistics

Threads
1,215,054
Messages
6,122,895
Members
449,097
Latest member
dbomb1414

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top