اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

خطأ بجملة mySQL


الردود الموصى بها

السلام عليكم ورحمة الله وبركاته

برجاء المساعدة في تصحيح جملة MySQL

يوجد خطأ في جملة الاستعلام التالية في السطر الثاني

    mySQL = "Select * From Query2"
    mySQL = mySQL & " WHERE IDStu  Between [Forms]![X1]![A1] And [Forms]![X1]![A2] & """
    Set rst = CurrentDb.OpenRecordset(mySQL)
    rst.MoveLast: rst.MoveFirst

الذي اريده ان يتم حصر الارقام حسب مدخلات النموذج X1بين A1 And A2

ولكم وافر التحية

تم تعديل بواسطه محمد ابوعبد الله
رابط هذا التعليق
شارك

وعليكم السلام 🙂

 

اذا كان الحقل IDStu رقم:

    mySQL = "Select * From Query2"
    mySQL = mySQL & " WHERE IDStu  Between " & [Forms]![X1]![A1] & " And " & [Forms]![X1]![A2] 
    Set rst = CurrentDb.OpenRecordset(mySQL)
    rst.MoveLast: rst.MoveFirst

 

بينما اذا كان الحقل IDStu تاريخ:

    mySQL = "Select * From Query2"
    mySQL = mySQL & " WHERE IDStu  Between #" & [Forms]![X1]![A1] & "# And #" & [Forms]![X1]![A2] & "#"
    Set rst = CurrentDb.OpenRecordset(mySQL)
    rst.MoveLast: rst.MoveFirst

 

جعفر

  • Like 3
رابط هذا التعليق
شارك

هذا معناه انه لا توجد سجلات بين هذين الرقمين 🙂

 

استعمل هذه الطريقة للتخلص من هذه الرسالة:

private sub abc_click()

on erroro goto err_abc_click
	dim rst as dao.recordset

    mySQL = "Select * From Query2"
    mySQL = mySQL & " WHERE IDStu  Between " & [Forms]![X1]![A1] & " And " & [Forms]![X1]![A2] 
debug.print mySQL    'حتى نرى الجملة كاملة في اسفل الشاشة، ونستطيع لصقها في الاستعلام حتى نرى النتيجة هناك
	Set rst = CurrentDb.OpenRecordset(mySQL)
    rst.MoveLast: rst.MoveFirst

Exit_abc_click:
	
	rst.close: set rst=nothing

	exit sub
err_abc_click:

	if err.number=3021 then
		'no records
		resume Exit_abc_click
	else
		msgbox err.number & vbcrlf & err.description
	end if

end sub

 

جعفر

  • Like 2
رابط هذا التعليق
شارك

افلح وجهك يا غالي

الخطأ من عندي انا

الحمد لله تم الحل

وجزاك الله خيرا اخي الحبيب

تحياتي

  • Like 1
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information