Inputbox update fields

Denmla

Registered User.
Local time
Today, 09:10
Joined
Aug 9, 2012
Messages
13
Hi,

I'm doing a program to check the warehouse orders.

I need help with InputBox.
Does someone can help me with the command to update the barcode field.

The table is called a scan, the field is called barcodes.

Forth below is the process by which I have worked for the same to me nothing happened.

Please help !!!




Private Sub Command7_Click ()

Dim Barcode As String
Dim Sken As String


Barkod = InputBox ("Enter the barcode")

DoCmd.RunSQL "INSERT INTO SKEN" & _
"SELECT barcode"

end Sub
 
http://fontstuff.com/access/acctut16.htm review this
On top of your code page - add this text: Option Explicit
Then on your code menu Debug ---> Compile
This extra step will help you find typos.
It also forces a variable to be defined before it can be used.

Example:
DoCmd.RunSQL "INSERT INTO tblTest ([FName], [LName], [MyDate])
VALUES ('Martin', 'Green', #09/27/1950#);"

If the inputbox was:
MyFirstName = Inputbox("please enter first name")

DoCmd.RunSQL "INSERT INTO tblTest ([FName], [LName], [MyDate])
VALUES (' " & MyFirstName & " ', 'Green', #09/27/1950#);"

Note how the single quote is before the double quote - then the variable is pasted (with the & ) so the variable can be used.
The single quote followed by the double quote has a space in this example so you can view it better - don't actually leave the space there.
This example was used in case you ever use a date later. Note the # sign is used to define a date.
 
Thx for helping, now is working.

Private Sub Command7_Click()

BARKOD = InputBox("Upiši barkod", BARKOD)

DoCmd.RunSQL "INSERT INTO Sken VALUES (" & BARKOD & ");"
DoCmd.RunMacro ("m_Refresh")

End Sub

How do I get to repeat the command.
For example, now after each entry barcode must touch the "command7" to enter the new barcode.
I wish to have it automatically opens after entering barcode.

How?
 

Users who are viewing this thread

Back
Top Bottom