A
alpinhasov
Hello, I would like to know how to run a query in vba. In the cod
below I tried to create a query and run it but it just showed me th
query in the message box.
Also if I have a form keep the values when I press a button which wil
take me to another form. The values which were in the first form wil
be then put automatically to the other form. Obviously the field
that will be copied are the same on th
two forms
Private Sub insertData_Click(
Dim myconnection As ADODB.Connectio
Set myconnection = CurrentProject.Connectio
Dim myrecordset As New ADODB.Recordse
myrecordset.ActiveConnection = myconnectio
myrecordset.Open "studdemo", , adOpenStatic, adLockOptimisti
Dim result As Strin
Dim minhag As Strin
minhag = "SELECT STDLASTN FROM STUDDEMO
'DoCmd.RunSQL minha
result = Me![txtMy] & " " & Me![txtMc
MsgBox ("You have entered in My and Mc information " & result
MsgBox ("The full name is " & Me![fullname]
MsgBox ("The students cuastom is " & minhag
Dim myQuery As Strin
'myQuery = "Insert into MINYAN (date, fullname, My, Mc ) Value
Me![date], Me![fullname], Me![txtMy], Me![txtMc]
'DoCmd.RunSQL myQuer
End Su
below I tried to create a query and run it but it just showed me th
query in the message box.
Also if I have a form keep the values when I press a button which wil
take me to another form. The values which were in the first form wil
be then put automatically to the other form. Obviously the field
that will be copied are the same on th
two forms
Private Sub insertData_Click(
Dim myconnection As ADODB.Connectio
Set myconnection = CurrentProject.Connectio
Dim myrecordset As New ADODB.Recordse
myrecordset.ActiveConnection = myconnectio
myrecordset.Open "studdemo", , adOpenStatic, adLockOptimisti
Dim result As Strin
Dim minhag As Strin
minhag = "SELECT STDLASTN FROM STUDDEMO
'DoCmd.RunSQL minha
result = Me![txtMy] & " " & Me![txtMc
MsgBox ("You have entered in My and Mc information " & result
MsgBox ("The full name is " & Me![fullname]
MsgBox ("The students cuastom is " & minhag
Dim myQuery As Strin
'myQuery = "Insert into MINYAN (date, fullname, My, Mc ) Value
Me![date], Me![fullname], Me![txtMy], Me![txtMc]
'DoCmd.RunSQL myQuer
End Su