By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Query Error in VBA Access 2000

P: 2
Forgive me as I am new to this forum and to Access, but here is my code. I can't get the Employee name to come up, only the Employee ID number.

Expand|Select|Wrap|Line Numbers
  1. Private Sub List2_AfterUpdate()
  2.     With Me.List4
  3.         .RowSource = "SELECT InventoryID, Platform, EmployeeID " & _
  4.         "FROM Inventory " & _
  5.  
  6. (This is where I put my inner join to join the tables, Inventory and Employees).
  7.  
  8.        "WHERE Company = " & Chr(34) & Me.List0 & Chr(34) & _
  9.         "AND Application = " & Chr(34) & Me.List2 & Chr(34) & _
  10.         "ORDER BY InventoryID, Platform, EmployeeID"
  11.  
  12. (Then I placed Employees.Employee in place of EmployeeID and changed that in the SELECT portion of the above rowsource).
  13.  
  14.         .ColumnCount = 3
  15.         .ColumnWidths = "0;1.5 IN;1.5 IN "
  16.         .ColumnHeads = True
  17.         .Requery
  18.          End With
  19.     With Me.List2
  20.      End With
  21.         Me.Label7.Caption = Me.List4.ListCount & _
  22.         " Platforms and Employees in " & Me.List2 & ", " & _
  23.         Me.List0
  24. End Sub
I get a syntax error, but can't figure out why.
Any suggestions?
dewylie
Jan 11 '07 #1
Share this Question
Share on Google+
4 Replies


NeoPa
Expert Mod 15k+
P: 31,261
I suggest you post the code you're actually using with the error message and an indication of the line it highlights when reporting the error.
Jan 12 '07 #2

MMcCarthy
Expert Mod 10K+
P: 14,534
Try this ..

Expand|Select|Wrap|Line Numbers
  1. Private Sub List2_AfterUpdate()
  2.     With Me.List4
  3.         .RowSource = "SELECT InventoryID, Platform, Employee " & _
  4.         "FROM Inventory INNER JOIN Employees " & _
  5. "ON Inventory.EmployeeID=Employees.EmployeeID " & _
  6. "WHERE Company = " & Chr(34) & Me.List0 & Chr(34) & _
  7.         " AND Application = " & Chr(34) & Me.List2 & Chr(34) & _
  8.         " ORDER BY InventoryID, Platform, Employee;"
  9.  
  10. .ColumnCount = 3
  11.         .ColumnWidths = "0;1.5 IN;1.5 IN "
  12.         .ColumnHeads = True
  13.         .Requery
  14.          End With
  15.     With Me.List2
  16.      End With
  17.         Me.Label7.Caption = Me.List4.ListCount & _
  18.         " Platforms and Employees in " & Me.List2 & ", " & _
  19.         Me.List0
  20. End Sub
Jan 12 '07 #3

P: 2
Thank you, thank you, thank you, mmccarthy.
I just tried it and it works PERFECTLY! You are a lifesaver!!!
Jan 12 '07 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
Thank you, thank you, thank you, mmccarthy.
I just tried it and it works PERFECTLY! You are a lifesaver!!!
Not a problem. I'm glad it worked out for you.

Mary
Jan 12 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.