Log in

View Full Version : Access code pull data in forms.fields from sql request troubleshot



saf111
12-05-2013, 01:29 AM
Hello , could tell me why i cant copypaste data from sql request in the field of the forms on Access here

Private Sub Form_Open(Cancel As Integer)
' dim strSql as string
strSQL = "SELECT table.[ID_Excel] FROM table wHERE ID=" & OrderID Debug.Print strSQL
' correctMe.RecordSource = strSQL
' nothing happening Me.field0.value = strSQL
' wrote in the field SELECT table.[ID_Excel] FROM table wHERE ID=" '
and not value of the SQS for example 15000
end sub

saf111
12-05-2013, 01:31 AM
Private Sub Form_Open(Cancel As Integer) ' form_test открывается
dim strSQL as string
strSQL = "SELECT zayvki.[ID_Excel] FROM zayvki wHERE ID=" & OrderID
Debug.Print strSQL ' запрос есть как положено
Me.RecordSource = strSQL ' ничего не делает here ****
Me.поле0.value = strSQL ' Here **** пишет в самом поле SELECT zayvki.[ID_Excel] FROM zayvki wHERE ID="
' а не результат запроса , например 15000
end sub