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

i don't find any data in the new table

P: 1
i have my little program that need to transfer about 1000 row from table 1 to new table that only contain that 1000 row i have transferred

note table1 contain about 10000 row
Expand|Select|Wrap|Line Numbers
  1. table1:-
  2. Public CLI1DT As New DataTable
  3. Public CLI1DA As New OleDbDataAdapter
  5. new table:-
  6. Public CLI11DT As New DataTable
  7. Public CLI11DA As New OleDbDataAdapter
  10. CLI1DA = New OleDbDataAdapter("select *from EMP where SITE like'%" & ComboBox1.Text & "%'", Con1)
  11.         CLI1DA.Fill(CLI11DT)
  13.         Dim save As New OleDbCommandBuilder(CLI11DA)
  14.         CLI11DA.Update(CLI11DT)
  15.         CLI11DT.AcceptChanges()
  16.         'CLI11DT.Clear()
  17.         CLI11DT_load()

the problem is i don't find any data in the new table
Aug 12 '18 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 5,397

+ Looks like you are attempting to connect to an external database and transfer data into the Access database?

+ Are you attempting to use .Net or VB instead of VBA within an Access database - these will not directly work in VBA procedures - did you borrow the code from somewhere? you need to post either the code you are using or the link to the site you borrowed the code from so we can take a look.
OleDbDataAdapter -isn't standard in Access VBA
OleDbCommandBuilder - isn't standard in Access VBA
If you are trying to use .Net then we may need to move your thread so that people more acquainted with it will see your question.

+ Unless what you have listed are only the titles of custom VBA code then what you have will not work in an Access database - BTW: Connection Strings can be found here for the OleDbDataAdapter you need to verify that "CON1" is properly formed string.

+ Pull this out into a string variable:
strSQL = "(select * from EMP where SITE like '%" & ComboBox1.Text & "%'"
Now you can insert a debug.print strSQL to make sure the string is properly formed, (same for your CON1 )- 90% of issues are malformed strings when used directly within a function or subroutine call.
I fixed a few spacing issues here; however, I don't have your system so I can't go any further than that and without more information on your code to see if the connection is being properly called that's as much help as you could wish for with the string.
"%" hmmm, unless your access database is set for ansi92 access will not recognize this as a wild card and I cannot tell what database you are attempting to connect to so no help there... at some point you should try " * " for the wildcard. I've only found the " % " to work for pass through queries to Large Factor Databases such as MySQL, SQLServer,

+ IF you are working from within Access then you should also check to that your code is compiling properly - reopen the VBA editor
Fix any errors, it must compile without errors before we can go any further.
Aug 12 '18 #2

Post your reply

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