Private Sub Command1_Click () Dim the name AsADODB. Connection Set name=NewADODB. Connection Cn. The Open ". The PROVIDER=Microsoft Jet. The OLEDB. 4.0; # Source=C: \ Users \ Administrator \ Desktop \ tidy home \ Database3 MDB;" Name. Execut "INSERT INTO life VALUES (' 001 ', 'zhang', 'the wind', 'p')" Name. The Close Set name=Nothing End Sub Have a great god can help you
CodePudding user response:
Change the two still have problems
Private Sub Command1_Click () Dim the name As ADODB. Connection Set name=New ADODB. Connection Name. The Open ". The PROVIDER=Microsoft Jet. The OLEDB. 4.0; # Source=C: \ Users \ Administrator \ Desktop \ tidy home \ Database3 MDB;" Name. Execut "INSERT INTO life VALUES (' 001 ', 'zhang', 'the wind', 'p')" Name. The Close Set name=Nothing End Sub CodePudding user response:
Information you also don't say, I don't have your project file, you let everybody how can I help you?
Preliminary doubt is form fields more than 4, if you have automatic growth column, then write fields, write the corresponding value behind
INSERT INTO table_name (column 1, 2,... ) VALUES (the value 1, 2,... )
CodePudding user response:
If there is a value is not in conformity with the column data format?
CodePudding user response:
Should use the strings behind ah, write directly, use the "+"
CodePudding user response:
reference 1st floor qq_38060420 response: change the two still have problem Private Sub Command1_Click () Dim the name As ADODB. Connection Set name=New ADODB. Connection Name. The Open ". The PROVIDER=Microsoft Jet. The OLEDB. 4.0; # Source=C: \ Users \ Administrator \ Desktop \ tidy home \ Database3 MDB;" Name. Execut "INSERT INTO life VALUES (' 001 ', 'zhang', 'the wind', 'p')" Name. The Close Set name=Nothing End Sub or I observant, you didn't find a word to write wrong? Execute written execut, words can't you just according to the error message to use their judgment? Will write "execut" can't find method, estimates the original poster is that the message box to watch the content, only see to determine the two words, the message box is used to turn off for you, CodePudding user response:
About whether he is suitable for programming is very simple test: On a newspaper or magazine articles, for a period of about 1000 words in Word input again, after losing to refer to the following answer: A. there are more than 10 words or punctuation B there is no words or punctuation mistakes and dare to bet for this No words or punctuation errors and C fonts and layout fully consistent with the original D print on the translucent paper and check the same original overlap, and feel very with a sense of accomplishment A is not suitable for programming (reason: typing accuracy is low, careless) B junior programmer (reason: typing accuracy high, careful and meticulous, confident, understand the whole Angle of half Angle concept) C senior programmer (reason: in the B on the basis of understanding the font and layout is also an important factor of computer to print, but compared to D paranoid enough, strives for perfection, the results can verify) D software project manager (reason: to be able to give convincing for project detailed requirements to the pole and typical test cases, users almost pick is not at fault, major!) If want to from A to B, to my resources http://download.csdn.net/detail/zhao4zhong1/4084259 download "for programmers keyboard practice" CodePudding user response:
reference 5 floor sysdzw reply: Quote: refer to 1st floor qq_38060420 response: Change the two still have problems Private Sub Command1_Click () Dim the name As ADODB. Connection Set name=New ADODB. Connection Name. The Open ". The PROVIDER=Microsoft Jet. The OLEDB. 4.0; # Source=C: \ Users \ Administrator \ Desktop \ tidy home \ Database3 MDB;" Name. Execut "INSERT INTO life VALUES (' 001 ', 'zhang', 'the wind', 'p')" Name. The Close Set name=Nothing End Sub or I observant, you didn't find a word to write wrong? Execute written execut, words can't you just according to the error message to use their judgment? Will write "execut" can't find method, estimates the original poster is that the message box to watch the content, only see to determine the two words, the message box is used to turn off for you, I said to it have been adjusted, external error definition name Private Sub Command1_Click () Dim the access As New ADODB. Connection Set the access=New ADODB. Connection Access. Open Access="Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source=C: \ Users \ Administrator \ Desktop \ pp \ Database3 MDB. Persist Security Info=False " Dim a, b, c, d As a String A=InputBox (number, [home], [] in the input) B=InputBox (ownership, [home], [] in the input) C=InputBox (item name, [home], [] in the input) D=InputBox (where things, [home], [] in the input) Access. The Execute "INSERT INTO life VALUES (a, b, c, d)" Access. Close Set the access=Nothing End Sub The first line of error CodePudding user response:
CodePudding user response:
refer to the eighth floor qq_38060420 response: error message box why not screenshot? CodePudding user response:
To ask, why not message box screenshot? CodePudding user response:
Dim a, b, c, d As a String A=InputBox (number, [home], [] in the input) B=InputBox (ownership, [home], [] in the input) C=InputBox (item name, [home], [] in the input) D=InputBox (where things, [home], [] in the input) Access. The Execute "INSERT INTO life VALUES ('" & amp; A. & amp; "', '" & amp; B & amp; "', '" & amp; C & amp; "', '" & amp; D & amp; "')"