JKing,
you have done it again. It works a treat. Thanks for getting me out of trouble again.
Regards
Martin.
User Profile
Collapse
-
Sorry JKing, I should have explained more. The code you originally sent me works fine and the insert problem is solved.
What I want to do now is another query to perform an update on the table Inventory in the database, based on the number set with var2. I would like to input var2 via a combobox and get the results back to multiple comboboxes and textboxes so the changes for the update can be made there.
For example,...Leave a comment:
-
A further question, is there an equivalent command to DMax (shown below) to bring back string to var1
var1 = DMax("[Number]", "Inventory" , "[Plant] = '" & var2 & "'") + 1
I hope there is.
MartinLeave a comment:
-
Hi
I got the code to work you gave me JKing. I just needed to include
Microsoft Access 11.0 Object Library
from Tool/References, and it works great.
Thanks for your help.
Martin.Leave a comment:
-
Hi JKing
Sorry to be a pain here, but having changed var1 to Integer, the debugger stops at the following line (highlighting DMax)
var1 = DMax("[Num]", "Inventory" , "[Plant] = '" & var2 & "'") + 1
with the following error.
"Compile Error - Sub or Function Not Defined.
Do I need to add in something from TOOLS/REFERENCES ?...Leave a comment:
-
Hi JKing
I like the idea of createing the var1 value before the original insert statement rather than the nested select. var1 was originally type string so I changed it to type Number. (Num is also type Number in the access database). When I try to run the insert, the VBA debugger stops at the
dim var1 as Number
with "Compile Error - User defined type not defined"
Any ideas?...Leave a comment:
-
SQL Insert from VBA to Access Database
Hi. My first post on the forum and I hope someone can help with this problem. I have a table called 'Inventory'. It has 11 fields, two of them being 'Num' and 'Plant'. There are a number of 'Plants' and the corresponding number ranges within those plants are:
Plant Number
TBM 1000 - 1099
ABC 1100 - 1199
AMS 1200 - 1299
BBR 1300 - 1399
etc.
So for TBM for example, it may have...
No activity results to display
Show More
Leave a comment: