¤ÀÃþ |
¼ÐÃD |
¤j·N |
§@ªÌ |
¤é´Á |
Dao ¾Þ§@ | ³v¨B¨ú¦^¤j«¬¸ê®Æ®wªº°O¿ý | ¡@ | ¦Ñ©Ç | 1998/11/13 |
Dao ¾Þ§@ | ³]©wÄæ¦ìªº¹w³]È | Field.DefaultValue Äݩʪº¨Ï¥Î | ¦Ñ©Ç | 1998/11/13 |
Dao ¾Þ§@ | ¦p¦ó§â FieldValue ©ñ¨ì ComboBox ùØ | Recordset °j°éªº»s§@ | ¦Ñ©Ç | 1998/11/18 |
Dao ¾Þ§@ | ¥Î ComBo ¾Þ§@¨âÓÄæ¦ì°O¿ý | ItemData ÄݩʨϥΠ| ¦Ñ©Ç | 1999/1/22 |
Dao ¾Þ§@ | Åý¨âÓ Combo ¨Ì Record ³s°Ê | ¡@ | ¦Ñ©Ç | 1998/11/26 |
Dao ¾Þ§@ | Recordset.Filter ©M SQL WHERE ªº¨Ï¥Î | Recordset ªº±ø¥ó¬d¸ß | ¦Ñ©Ç | 1998/11/28 |
Dao ¾Þ§@ | ¦p¦óÁÙì¤é´ÁÄæ¦ì¬°¥¼¿é¤J«¬ºA | FieldName.Value=Null | ¦Ñ©Ç | 1999/1/16 |
Dao ¾Þ§@ | ¶}±Ò¸ê®Æ®w¤¤¥ô¤@¸ê®Æªí | TabDefs ¶°¦Xª«¥ó¨Ï¥Î | ¦Ñ©Ç | 1999/2/12 |
SQL »yªk | ¦C¥X¯S©w®É¶¡°Ï¬qªº©Ò¦³°O¿ý | Between ªº±ø¥ó¬d¸ß | ¦Ñ©Ç | 1998/12/3 |
SQL »yªk | ¬°¸ê®Æ°O¿ý°µ¸s²Õ¤À¶µ²Îp | GROUP BY ±Ôz | ¦Ñ©Ç | 1999/1/20 |
SQL »yªk | ±N³s±µªººô¸ô¸ê®Æªí¦s¤J¥»¾÷¸ê®Æ®w | ²£¥Í¸ê®Æªí¬d¸ßªº¨Ï¥Î | ¦Ñ©Ç | 1999/1/22 |
SQL »yªk | ¦b SQL ¦r¦ê¤¤´¡¤J ['] ¦r¤¸ | Chr(Ascii Code) ªº¨Ï¥Î | ¦Ñ©Ç | 1999/1/28 |
DBGrid | ¨âÓ¤£¦P³]©wªº DBGrid ¦P¨B | Columns.Visible Äݩʪº§Q¥Î | ¦Ñ©Ç | 1998/11/19 |
DBGrid | Àx¦s DBGrid.Columns.Width ªº³]©w | Field.Property ª«¥óªº§Q¥Î | ¦Ñ©Ç | 1998/11/19 |
DBGrid | ³]©wÄæ¦ì¦WºÙ | Column.Caption Äݩʪº¨Ï¥Î | ¦Ñ©Ç | 1998/12/15 |
DBGrid | ¦C¦L DBGrid Cell ùتº¸ê®Æ(1999/4/3 ×¥¿) | DBGrid.CellText ¤èªkªº¨Ï¥Î | ¦Ñ©Ç | 1998/12/31 |
DBGrid | ¦hÄæ¤Î¦h¦C¿ï¨ú | ¡@ | ¦Ñ©Ç | 1999/1/4 |
DBList | ¥Î DBList_Click ²¾°Ê°O¿ý«ü¼Ð | SelectItem Äݩʪº¨Ï¥Î | ¦Ñ©Ç | 1998/12/25 |
¸ê®Æ¤ÀªR | À³·í¤À³Îªº¸ê®Æªí | ¸ê®Æ²Ó¤ÀªºÆ[©À | ¦Ñ©Ç | 1998/12/15 |
¸ê®Æ¤ÀªR | ¦A½Í¸ê®Æ®wÄæ¦ì¤¤ Null Ȫº³B²z | ¸ê®Æ®w¦w¥þ»P¨Ï¥ÎªÌ«K§Q | ¦Ñ©Ç | 1999/1/16 |
JMilk ¼¶¼g©ó¤å³¹
§Ún¨ú¦^¸ê®Æ®w¤¤¤@¤j¦ê¸ê®Æ, ¥i¬O, ¨C¨C³£³y¦¨¹O®É.©Ò¥H, §Ú·Qn¥Î record set ªº¤À¶§Þ¥©, ¤@¤p³¡¥÷¤@¤p³¡¥÷ªº®³¦^¨Ó.·Ð½Ð½ç±Ð.
¦Ñ©Çµª¡G
±H¥óªÌ: sam
¤é´ÁªºÄæ¦ì¡A¦b¨Ï¥Î¥Lªº®ÉÔ§Ú·Q³]©w¬°·í¤éªº¤é´Á¡A¦ý·íÀx¦s«á¡A§Ú¤£·Q¥L¦A¸ò¤é´Á¦Ó§ï¡A½Ð°Ýn¦p¦ó°µ©O¡H
¦Ñ©Çµª¡G
¦w´µ¯Pº¸ ¼¶¼g©ó¤å³¹
¦p¦ó¥ÎComboª«¥ó¡A±NDataBase¤¤ªºRecordSource¥þ³¡Åª¥X¨Ó¡A°µ¦¨AddItemªº¤è¦¡¡C
¦Ñ©Çµª¡G
Dim Db as database
Dim Rs as recordset
set Db=opendatabase("YourDataPath&Name")
set Rs=Db.openrecordset("yourtablename")
Rs.MoveFirst
Do While Not Rs.Eof
combo1.additem Rs!"YourFieldName"
Rs.MoveNext
Loop
linux ¼¶¼g©ó¤å³¹
§Ú¸ÕµÛ¨âÓ form ¶}¤£¦Pªº DBGrid¡A¥Î¦P¤@Ó Data Table ¡A¦ý¤@Ó¥uÅã¥Ü¤@¨ÇÄæ¦ì , ¤@Ó¥þ³¡³£Åã¥Ü¡A¦ý§ÚµLªk¦P¨B»¡¡C¨Ò¦p : movenext ,moveprevious,movelast,movefirst ¤@¦¸²¾¨âÓ DBGrid ªº°O¿ý«ü¼Ð¡H
¦Ñ©Çµª¡G
Form1¡G
§â Data1 ªº DataBaseName ©M ReCordSource ³]¦n¡C
Form2¡G
Set Data1.Recordset = Form1.Data1.Recordset
'§â¤£n¦b DBGrid ùØÅã¥ÜªºÄæ¦ìÂð_¨Ó
DBGrid1.Columns("Field2Name").Visible = False
DBGrid1.Columns("Field3Name").Visible = False
DBGrid1.Columns("Field4Name").Visible = False
Paper Crane ¼¶¼g©ó¤å³¹
¥Î DBGrid ¬Ý¸ê®Æ®É, ¨C¦¸³£n¥Î·Æ¹«¥h½ÕÄæ¦ì¼e«×¡A¨ºn«ç¼Ë¤~¯à§â½Õ¦nªº¦ì¸m¦s°_¨Ó ? ¤£µM¨C¦¸³£n¦A½Õ¤@¦¸¡AÄÝ©ÊÄæ¸Ì¦n¹³¨S¿ìªkÀx¦s³o¶µ¸ê®Æ£z£®¡I
¦Ñ©Çµª¡G
DBGrid1.Columns(Index).Width ÄÝ©ó°õ¦æ´Á³]©w¤§ÄÝ©Ê¡A¨S¿ìªk«O¯d¨ì¤U¦¸±Ò°Êµ{¦¡®É¡C¹ê»Ú¤W Data ©M DBGrid ³£¨S¦³³oºØÄݩʳ]©w¡A¤£¹L§ÚÌ¥i¥H§â DBGrid ªº ColumnWidth ¸ê®Æ°O¨ì MDB ¸ê®Æ®wªº Properties ¶°¦XùØ¡A«Ü¤Ö¬Ý¨ì VB ¤Í¥Î MDB Property ª«¥óªº¡A³oªF¦è¥i¥H CreatNew ¡A¥i¥H Read and Set (n¬ÝÄݩʪ¬ªp¡A¤£¬O©Ò¦³³£¾A¥Î¡C)½Ð°Ñ¦Ò¥H¤U½d¨Ò¡C
'¥»½d¨Ò¬O§Q¥Î Dao Field ª«¥óªº Propertys ¶°¦Xùتº ColumnWidth ÄÝ©Ê
'¨Ó°O¿ý DBGrid ªº ColumnWidth È¡A¨Ï±o¨Ï¥ÎªÌ§ïÅÜ DBGrid ªº ColumnWidth
'¥i¥H«O¦s¤U¨Ó¡A¦b¤U¦¸±Ò°Ê®Éºû«ùì¨Óªº³]©w¡Anª`·Nªº¬O ColumnWidth ªºÈ
'¤£¦b Data ©M DbGrid ÄÝ©ÊùØ¡A¦Ó¬O¦s©ñ¦b MDB ¸ê®Æ®w¥»¨¡A³oºØ§ïÅܤΩó
'¥H Access ¶}±Òªº Table¡C
'´ú¸Õ¥»½d¨Ò½Ð©óªí³æ¤W¥¬¸m Data1,Dbgrid1
Option Explicit
Dim Db As Database
Dim Rs As Recordset
Dim Td As TableDef
'¶}±Ò¸ê®Æªí¤§¦WºÙ
Dim TDName As String
'¨ú¥X ColumnWidth ªº Property.Value
Private Function GetCellWidth(TempFd As Field) As Single
'¦pªG ColumnWidth ªº Property.Value µ¥©ó¹w³]È¡A«h¥ýÅý
'DBGrid ªº ColumnWidth =1500
If TempFd.Properties!ColumnWidth.Value = -1 Then
TempFd.Properties!ColumnWidth.Value = 1500
TempFd.Properties.Refresh
End If
GetCellWidth = TempFd.Properties!ColumnWidth.Value
End Function
'¦pªGµo¥Í ColResize ¨Æ¥ó«h³]©w ColumnWidth ªº Property.Value
Private Sub DBGrid1_ColResize(ByVal ColIndex As Integer, Cancel As Integer)
SetCellWidth DBGrid1.Columns(ColIndex).DataField, _
DBGrid1.Columns(ColIndex).Width
End Sub
Private Sub Form_Load()
TDName = "Student"
Set Db = OpenDatabase("C:\test\mytest.mdb")
Set Rs = Db.OpenRecordset(TDName)
'TabelDef ¦b¦¹³B¤£¯à¥Î Recordset ¥N´À¡A¦]¬° Field.Propertis ¥u¦³¥Î
'TabelDef ¤Î QueryDef ¤~¯à°Ñ·Ó¨ì¡A¥Î Recordset ¨Ó°Ñ·Ó·|¦³µLªk³]©wªº
'¿ù»~
Set Td = Db.TableDefs(TDName)
Set Data1.Recordset = Rs
GetAllColWidth
End Sub
'¨ú±o¥ý«eÀx¦s Filed.Properties!ColumnWidth ªº Value
Private Sub GetAllColWidth()
Dim I As Integer
Dim SendField As Field
For I = 0 To DBGrid1.Columns.Count - 1
Set SendField = Td.Fields(DBGrid1.Columns(I).DataField)
DBGrid1.Columns(I).Width = GetCellWidth(SendField)
Next
End Sub
Private Sub Form_Unload(Cancel As Integer)
Rs.Close
Db.Close
End Sub
'³]©w ColumnWidth ªº Property.Value
Private Sub SetCellWidth(ByVal FDName As String, ByVal CellWidth As Single)
Td.Fields(FDName).Properties!ColumnWidth.Value = CellWidth
Td.Fields(FDName).Properties.Refresh
End Sub
Zima T. ¼¶¼g©ó¤å³¹
Y§Ú¥Î¨âÓ comboxA & comboxB ¦P®É¤]³£³sµ²¸ê®Æ®w field1 & Field2¡A·í§Ú¿ï¨ú comboxA(comboxB) ªº¶µ¥Ø®É ¦p¦óÅý comboxB(comboxA) ªº¸ê®Æ¤]¦P®É°µÅÜ°Ê©O?
¦Ñ©Çµª¡G
Option Explicit
Private Sub Combo1_Click()
Dim SearchNo As Long
Dim I As Long
SearchNo = Combo1.ItemData(Combo1.ListIndex)
For I = 0 To Combo2.ListCount - 1
If Combo2.ItemData(I) = SearchNo Then
Combo2.ListIndex = I
Exit For
End If
Next
End Sub
Private Sub Combo2_Click()
Dim SearchNo As Long
Dim I As Long
SearchNo = Combo2.ItemData(Combo2.ListIndex)
For I = 0 To Combo1.ListCount - 1
If Combo1.ItemData(I) = SearchNo Then
Combo1.ListIndex = I
Exit For
End If
Next
End Sub
Private Sub Form_Activate()
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
Combo1.AddItem Data1.Recordset!Name
'¥»½d¨Òªº«ÂI¬O PrimaryKey Serial Äæ¦ì¬O¤@ªø¾ã¼Æ«¬ºA
'§Y¥i§â¥L¥[¦b ItemData ùØ°µ¯Á¤Þ
Combo1.ItemData(Combo1.NewIndex) = Data1.Recordset!Serial
Combo2.AddItem Data1.Recordset!Note
Combo2.ItemData(Combo2.NewIndex) = Data1.Recordset!Serial
Data1.Recordset.MoveNext
Loop
Combo1.ListIndex = 0
Combo2.ListIndex = 0
End Sub
±H¥óªÌ: Young Team Inc.
§Ú»s§@¤F¤@Ó¦³Ãö¬d¸ßªºµ{¦¡(¸ê®Æ¬ù¤@¸Uµ§)¡A¦b§@±ø¥ó¬d¸ß®ÉÁö¦³§Q¥Î¨ì¯Á¤Þ¦ý³t«×ÁÙ¬O«ÜºC¡FVB¤¤¦³Ó Filter ªº¥\¯à¦n¹³¤£¿ù¡A¦ý§Ú¬Ý¤£¤ÓÀ´¨Ï¥Î»¡©ú¡A¤£ª¾¥i§_±Ð±Ð§Ú¦³Ãö Filter ªº¹B¥Î¡AÁÂÁ¡C
¦Ñ©Çµª¡G
Option Explicit
Dim Db As Database
Dim Rs As Recordset
Dim Rs1 As Recordset
'§Q¥Î Recordset.Filter Äݩʧ@±ø¥ó¬d¸ß
Private Sub Command1_Click()
Rs.Filter = "Name Like '*D*'"
Set Rs1 = Rs.OpenRecordset
Set Data1.Recordset = Rs1
End Sub
'§Q¥Î SQL WHERE ±Ôz§@±ø¥ó¬d¸ß
Private Sub Command2_Click()
Dim SQLString As String
SQLString = "SELECT * FROM Student WHERE Name LIKE '*D*'"
Set Rs1 = Db.OpenRecordset(SQLString)
Set Data1.Recordset = Rs1
End Sub
Private Sub Form_Load()
Set Db = OpenDatabase("c:\test\mytest.mdb")
'¥²¶·«ü©w Recordset ¶}±Ò«¬ºA¬°
'dynaset
'snapshot
'forward-only
'Filter property ¤~¯à¨Ï¥Î
Set Rs = Db.OpenRecordset("student", dbOpenDynaset)
Set Data1.Recordset = Rs
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Rs.Close
Rs1.Close
Db.Close
End Sub
¨Ï¥Î Filter ©M Where ±Ôz³Ì«áªºµ²ªG¬O¤@¼Ëªº¡A¦ý¦] Filter ¥u¯à¾A¥Î Jet MDB ¸ê®Æ®w¡A¬°¤Fµ{¦¡ªº³q¥Î©Ê¡AÁÙ¬O¥Î WHERE ±Ôz¤ñ¸û¦n¡C
®ü¼Ü§g ¼¶¼g©ó¤å³¹
§Ú·Q¥Ñ :select * from table1.db where [TDate] like "1998/4/*"¨Ó§ä¥X¥|¤ë¥÷ªº©Ò¦³¸ê®Æ.....
¦Ñ©Çµª¡G
select * from table1.db where [TDate] Between #1998/4/1# And #1998/4/30#
¯è¦V¹Ú·Qªº¤Ñ°ó ¼¶¼g©ó¤å³¹
¨Ò¦p:¦³¤@¥x¤½¨® ¨ä¤½¨®¸¹½X©M¥¦¦æ¸gªº¦U¯¸¦Wn¦p¦ó³B²z©O?
> ¤½¨®¸¹½X | from | to
> ----------------------------
> 287 | ¤¤¤s¥«³õ | ¥x¥_¨®¯¸
> 287 | ¥x¥_¨®¯¸ | «n¶§µó
> 247 | ¤j¦P¤½¥q | ¥xªd¤j¼Ó
> 247 | ¥xªd¤j¼Ó | ¬ü³NÀ]
> 247 | ¬ü³NÀ] | ¤jª½
¦Ñ©Çµª¡G
°Õ°Õ°Õ ¼¶¼g©ó¤å³¹
§Ú¶}±Òdbgrid³oÓ±±¨î¶µ®É¡A¨º§Ún¦p¦ó¦b¨C¦æªº¦æº¿é¤JÄæ¦ì¦WºÙ©O??
¦Ñ©Çµª¡G
¨Ï¥Î DBGrid ªº Column ª«¥óªº Caption Äݩʦp¡G
Private Sub Form_Activate()
DBGrid1.Columns(0).Caption = "µ¹ÓÄæ¦W"
End Sub
dumb ¼¶¼g©ó¤å³¹
List ±±¨î¶µ¥i§Q¥Îlistindex «ü¥X¥Ø«e¿ï¶µ¦ì¸m¡A½Ð°ÝDblist ¥i¤£¥i¦æ ¦³³oºØ¥\¯à¶Ü?n¦p¦ó°µ©O?
¦Ñ©Çµª¡G
½Ð¨Ï¥Î
DBList.Text ©M
DBList.SelectItem ¨âÓÄÝ©Ê¡A½d¨Ò¦p¤U¡G
'°õ¦æ¥»½d¨Ò½Ð©óªí³æ¥¬¸m Data1,DBList1 ¡A¨Ã¦b DBList1 Äݩʵøµ¡ªº
'RowSource Äæ¦ì¶ñ¤J Data1¡C
Option Explicit
Dim TotalRec As Long
Dim Mark As Variant
Dim Db As Database
Dim Rs As Recordset
Private Sub Data1_Reposition()
Data1.Caption = Rs.AbsolutePosition + 1 & "/" & TotalRec
End Sub
Private Sub DBList1_Click()
Debug.Print DBList1.Text
Rs.Bookmark = DBList1.SelectedItem
End Sub
Private Sub Form_Load()
Set Db = OpenDatabase("c:\test\mytest.mdb")
Set Rs = Db.OpenRecordset("student", dbOpenDynaset)
Rs.MoveLast
TotalRec = Rs.RecordCount
Rs.MoveFirst
Set Data1.Recordset = Rs
DBList1.ListField = "Name"
End Sub
Private Sub Form_Unload(Cancel As Integer)
Rs.Close
Db.Close
End Sub
§¤¬Ý·°_¶³´é®É ¼¶¼g©ó¤å³¹
VB¤¤¦p¦ó¦C¦LDBGRIDS¤¤ªº¸ê®Æ?¥Î printer.print ¦ü¥G¬O¤£¤Ó¥i¦æªº,¦³¨ä¥¦ªº¤èªk¶Ü?
¦Ñ©Çµª¡G
¥i¥H¥Î Printer.Print ¨Ó¦C¦L¡A½Ð°Ñ¦Ò¤U¨Ò¡G
Dim I As Long, J As Long
Dim PrintString As String
For I = 0 To DBGrid1.VisibleRows - 1
For J = 0 To DBGrid1.Columns.Count - 1
PrintString = PrintString & DBGrid1.Columns(J).CellText(DBGrid1.RowBookmark(I)) & "/"
Next
Printer.Print PrintString
PrintString = ""
Next
Printer.EndDoc
1999/4/3 ¤é×¥¿¡G
¦b¦¹¦V¦U¦ì©êºp¡A쥻§Ú¥Î DBGrid.Columns(Index).CellText ³oÓ¤èªk¡A´N¬O¦]¬°¤£§Æ±æ«ü©w Row & Col ·|³y¦¨±²°Ê©ìºC³B²z³t«×¡Aµ²ªG³Ì«áµoı DBGrid ªº RowBuffer ¨Ã¤£¬O¦³¦h¤Ö°O¿ý´N³]¦h¤Ö¦C¡A¦Ó¬O¥u¦³¥iµø½d³òªº¦C¼Æ¸ê®Æ¦Ó¤w¡A·í¥¦±²¨ì¤U¤@¶®É¡A¤~·|·s Record ©ñ¨ìì Buffer ùØ¡C¦]¦¹n§â°O¿ý±qÀY¦L¨ì§À¡AÁÙ«D±²¤£¥i¡A©Ò¥H§Ú×¥¿¦p¤U¡A
Option Explicit
Private Sub Command1_Click()
Dim I As Long, J As Long, K As Long
Dim PrintString As String
For I = 0 To Data1.Recordset.RecordCount - 1
If K = DBGrid1.VisibleRows Then
'DBGrid ¤@©wn±²¨ì¥iµø¤~¯à¨ä RowBuffer ¤~·|¸ü¤J Data ¸ê®Æ
DBGrid1.Scroll 0, DBGrid1.VisibleRows
K = 0
End If
For J = 0 To DBGrid1.Columns.Count - 1
'DBGrid1.RowBookmark ¥u¯à§ì¨ì DBGrid ¥iµøªº Record BookMark
PrintString = PrintString &
DBGrid1.Columns(J).CellText(DBGrid1.RowBookmark(K)) & "/"
Next
Printer.Print PrintString
PrintString = ""
K = K + 1
'¥i¥H¨ú®ø¦¹±Ôz¡A¥[¤W¥u¬OÅý§A¬Ý¨ì¦C¦L¬OÃä±² DBGrid Ãä°õ¦æªº¡C
DoEvents
Next
End Sub
Private Sub Form_Activate()
'¦b°O¿ý¼Æ¶q«Ü¤j®É,¥²¶·§â°O¿ý²¾¨ì³Ì«á¡A§_«h Data1 ¥u·|¶ëº¡ Buffer ªº°O¿ý¦Ó¤w¡C
Data1.Recordset.MoveLast
'¥²¶·§â°O¿ý±²¦^¶}©l¡A¥H«K DBGrid ¦C¦L¡C
Data1.Recordset.MoveFirst
'«n¡A²¾¨ìµ²§À¦A²¾¦^¶}ÀY¡A¬O¬°¤F¸ê®Æ§¹¾ã¨Ã¥B¥¿½T¡C
End Sub
®z¤ô¤T¤d,¥u¨ú¤@¿]¶¼ ¼¶¼g©ó¤å³¹
½Ð°ÝDBGrid¥i¥H°µ¨ìmulti-select¶Ü?
¦Ñ©Çµª¡G
ªü¤ò ¼¶¼g©ó¤å³¹
¦b¼¶¼g¸ê®Æ®wªºµ{¦¡®ÉÄæ¦ìªºÈ¸Ó¦p¦ó¨ú±Ë??«ü¦bMicrosoft Access¤¤Äæ¦ì©w¸q®É,¤¹³\NullÈ¡B¥²¶·¦³Èµ¥³]©w¸Ó¦p¦ó¨ú±Ë??
¦Ñ©Çµª¡G
Null Ȥ§©Ò¥H¥²¶·Á׶}¡A¬O¦]¬°¥¦·|³y¦¨¹Bºâ¥¢®Ä¡A¤]´N¬O¥ô¦ó«¬ºAªºÄæ¦ì©MÅܼƻPNull °µ¹Bºâ¡Aµ²ªG³£·|¬O Null¡A¤]¦]¦¹¸òµÛ¥¦¥X¨Óªº Query ©M Recordset ¸ÓÄæ¦ì³£·|¬O Null¡C¦pªG§A¥u¬O³æ¯ÂªºÅã¥Ü¥¦¡A¨ºµ²ªG¬O¤@ӪťաA·íµM¨SÃö«Y¡A¦ý¦pªG§A°µ¤@¨ÇÄæ¦ìµ²¦X¹Bºâ¡A¨º§t Null Èpºâµ²ªG·|§¹¥þ¤£¦P©ó¤£§t Null Ȫºpºâµ²ªG¡C¦pªG§A®e³\¤@ÓÄæ¦ì¦³ Null È¡A¨º³Ì«áµ²ªG±N¬O«D§A©Ò¹w´Áªº¡C
©Ò¥H¦b§ÚÌè¾Ç²ß Access ®É¡A©Î³\¤j®a³£¤£¦b¥GÄæ¦ì¦³ Null È¡A¦ýÀHµÛ¸ê®Æªí¼W¦h¡A©¼¦¹Ãö«Y¤é¯q½ÆÂø¡AÄæ¦ìºî¦X¹Bºâ·U¨Ó·U¦h¡A¤@Ó¤¹³\ Null ȪºÄæ¦ì³]©w¡A±N¦¨¬°¤@Áû®IÂ꺦a¹p¡A¥¦·|Åý§Aµ{¦¡¥Rº¡¤£½T©w©Ê¦ÓµLµ·²@ĵ§i¡A¬Æ¦Ü³Ì«á¥²¶·¸Ó¸ê®Æªí¤Î©Ò¦³¬ÛÃöªºQuery¡BForm¡BReport ³£n«°µ¡A³o¤]´N¬O Access ³o»òÂû±C¡A¦b§AÄæ¦ì¬° Null È®Én¤@¦A´£¿ô§Aªºì¦]¡C
ªü¤ò ¼¶¼g©ó¤å³¹
¦AªÌ¡A¦b¼¶¼g¸ê®Æ®wµ{¦¡®É¡A¨Ï¥ÎªÌ©Ò¿é¤Jªº¸ê®Æ¦s¨ì¸ê®Æ®w¤¤«á¡Aµo²{¥²¶·¦³ÈªºÄæ¦ì¡F¨Ï¥ÎªÌ¥¼¿é¤J¥ô¦óÈ¡A¦¹®ÉAccess·|µo¥Í¿ù»~¡A¹ï©ó³o¼Ëªº¤@Ó°ÝÃD¤£ª¾¹D¬O¸Ó¦bµ{¦¡¤¤¥[¤JÀˬd¥²¶·¦³ÈªºÄæ¦ì¬O§_¤w¿é¤Jªº§PÂ_¡HÁÙ¬O³æ¾a¥H¸ê®Æ®wµo¥Í¿ù»~«á¦A¥h°µ®·®»¸ê®Æ®wªº¿ù»~ªº°T®§¤§«á¦A¤ÏÀ³µ¹¨Ï¥ÎªÌ??
¦Ñ©Çµª¡G
§A¤£À³¸Ó§â³o°T®§§iª¾¨Ï¥ÎªÌ¡A¦]¬°¥L¨Sªk²z¸Ñ(¤]¨S³d¥ô²z¸Ñ) Null ȹï¸ê®Æ®wéw¹B§@ªº¶Ë®`¡A¥L¥u¬O·Q¡y§Ú¥ý¶°¤¤¿é¤J¦¹¸ê®Æ®wªº³o³¡¥÷Äæ¦ì¡A«Ý·|§Ú¦A¿é¤J¨º¤@³¡¥÷Äæ¦ì¡C¡z·í§A¨î¥L³o¶µ¦Û¥Ñ®É¡A§A»{¬°¥L·|«ç¼Ëµû»ù§A³]pªºµ{¦¡¡H
¦Ü©ó¨Æ¥ý¦bµ{¦¡¤¤¥[¤JÀˬd¡A¦n¤@ÂI¡A¦ýÁÙ¤£¬O«Ü¦n¡A¦]¬°§AÁÙ¬O¨î¤F¥Lªº¨Ï¥Î¦Û¥Ñ¡C©Ò¥H§Ú»{¬°³Ì¦nªº¤è¦¡¬O§Q¥Î Field.DefauldValue ªº³]©w¡A©Î¬O¦b Append °Ê§@®É¡A¦pªG¨Ï¥ÎªÌ¥¼¿é¤J«h©ñ¨Çªì©lȶi¤J¥²¶·¦³ÈªºÄæ¦ìùØ¡AÅý¨Ï¥ÎªÌ¨É¦³ÁöµM¯Ê¤F¨ÇÄæ¦ì¸ê®Æ¡A¦ý¤´¥i¦³·s¼W°O¿ýªºÅv§Q¡A¦Ü©ó DefaultVale ¬On´XӪťզr¤¸©Î¨ä¥LÈ¡A´N¬Ý§A¤é«á¥´ºâ«ç»ò¦A§Q¥Î³o¨ÇÄæ¦ì¤F¡C
¨ä¹ê³Ì«á³oÓ°ÝÃD·|¦^¨ìµ{¦¡³]p®v¨}¤ß³o»òÓ°ò¥»ªº¤H©Ê°ÝÃD¤W¡Aªº½T¡A¦ó¥²§âÄæ¦ì³]¦¨¥²¶·¦³È³o»ò¨¯W¡H°®¯Ü³q³q¤¹³\ Null È¡A§A³]pªº»´ÃP¡A¨Ï¥ÎªÌ¥Îªº¦Û¥Ñ¡A¤Ï¥¿¥un§Ú´£¨Ñªº¥\¯à¨S°ÝÃD¡A½Ö¤SºÞ±o¤F¥H«á³o¨Ç¸ê®Æ¦A§Q¥Î©Ê¦p¦ó¡A¬Æ¦Ü±N¨Ó¦A§Q¥Î·d±oµJÀYÄêÃB¡A¨º¤]¬O¤UÓ±µ®×ªºË¾`°ªº¨Æ¡A¤j®a¬Æ¦ÜÁÙ·|Ãh©À§A¡A»¡§A³]p®É³£¨S°ÝÃD¡A´«Ó¤H´N°ÝÃD¤@°ï¡C
¦ý¦pªG§AÁÙ¦³¤@¨Ç±M·~ªº¤£¦w»P¤£§Ô¡A¨º§A§K¤£¤Fn¬°¤F±N¨Óªºµo®i¦Ó¨î²{¦b¨Ï¥ÎªÌªº¦Û¥Ñ¡A¤Sn¬°«ç¼Ë´î¤Ö³o¨Ç¨î±a¨Óªº¤£«K¦Ó«õªÅ¤ß«ä¡A¦h¼g¤@°ïµ{¦¡½X¡CÁa¨Ï§A¦p¦¹W¤ßºÜ¼{¡A«o¥¼¥²¯à±o¦Ñª©©Î·~¥Dªº»{¦P¡A¦]¬°§A¶}µoªº®É¶¡¤ñ¤Hªø¡A§A¼gªºµ{¦¡¤ñ¤H®aÅo¶Û¡C©Ò¥H¡A¬Ý§A¦Û¤v§a¡A¦Ñ©Ç¬ÝªºÀ´µ{¦¡¡A«o¥¼¥²¬ÝÀ´¤H¥Í¡A¸Ó°µÓ«ç¼Ëªºµ{¦¡³]p®v¡A¥u¦³§A¦Û¤v¯à¨M©w¤F¡C
±H¥óªÌ: chiu
¦b¤@form¤¤¡A«Ø¥ß¤@Ótextbox¡A¦ý¦¹textboxªº¤º®e¬°access¸ê®Æ®w¤§¤é´Á«¬ºAÄæ¦ì¡A¤µ¤ÑY§Ú¹ïtextbox¿é¤J¸ê®Æ«á¡Aµo²{¿é¿ù¤é´Á¦Ón±Ntextbox¤º®eÅܦ¨ªÅ¥Õ(null)¬O§_¦³¿ìªk¿ì¨ì¡H
¦Ñ©Çµª¡G
¦³¿ìªk¡A¥Î Recordset!FieldName.Value=Null ªº±Ôz¡A»yªk¦p¤U¡G
Private Sub Data1_Validate(Action As Integer, Save As Integer)
If TextBox.Text = "" Then
Data1.Recordset.Edit
Data1.Recordset!FieldName = Null
Data1.Recordset.Update
End If
End Sub
Ä«ªG¿} ¼¶¼g©ó¤å³¹
§Úªº¸ê®Æ®w¥ÎSQL¡A¨ä¤¤¤@Ótable¥sºû×ÀÉ,¦³¤@ÓÄæ¦ì¥s"¦A«×¥s×ì¦]"(ì¦]¦³¥|Ó,¬O¥Îoption¿ï¨úªº)¡A>¦pªGn°µ¦¨³øªí,¸Ó¦p¦ó²Îp¨CÓì¦]ªº¦¸¼Æ¥Î³øªíÅã¥Ü¥X¨Ó¡H
¦Ñ©Çµª¡G
SQLString="SELECT ¦A«×¥s×ì¦], Count(¦A«×¥s×ì¦]) AS ¥sצ¨¦]¦Xp " & _
"FROM table_ºû×ÀÉ " & _
"GROUP BY ¦A«×¥s×ì¦]"
±H¥óªÌ: sillen
½Ð°Ý¥i¤£¥i¥H¦b§â¤@ÓMDB¸ê®Æ®w¤¤ªº¸ê®ÆªíÅã¥Ü¦b¤@ÓLIST¤¸¥ó¤¤©O?¦]¬°§Ú§Ë¤F¤@Ócommand dialog ªº¤¸¥ó¨Ó¿ï¨úMDBªº¸ê®Æ®w¡A¥i¬O¤£ª¾¦p¦ó¦A¿ï¨úMDB¸ê®Æ®w¤¤ªº¸ê®Æªí..... ?
¦Ñ©Çµª¡G
'´ú¸Õ¥»µ{¦¡½Ð©óªí³æ¥¬¸m Data1,DBGrid1,CommonDialog1,List1
Option Explicit
Dim Db As Database
Dim Rs As Recordset
Private Sub Form_Load()
Dim Tb As TableDef
CommonDialog1.filename = ""
CommonDialog1.ShowOpen
If CommonDialog1.filename <> "" Then
Set Db = OpenDatabase(CommonDialog1.filename)
For Each Tb In Db.TableDefs
'Tabledef.Attributes ÄݩʬO°O¸ü¦U¸ê®Æªí¯S©Êªº¤@ÓÄÝ©Ê¡A¨ä¤¤ dbSystemObject ªí¥Ü
'¸Ó¸ê®Æ¬° MDB ¨t²Î¸ê®Æªí¤£¥i¥Ñ¨Ï¥ÎªÌ¶}±Òקï¡C
If Not Db.TableDefs(i).Attributes And dbSystemObject Then
List1.AddItem Tb.Name
End If
Next
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
Rs.Close
Db.Close
End Sub
Private Sub List1_Click()
Set Rs = Db.OpenRecordset(List1.List(List1.ListIndex))
Set Data1.Recordset = Rs
End Sub
±H¥óªÌ: Jimmy Cheng
Y Table1 ¬°«È¤áÀÉ¡A¦³·~°Èû©m¦W¤Î·~°Èû¥N¸¹¨âÄæ¦ì¡A½Ð°Ý¦p¦ó¦b Combo ¤¤ÂI¿ï·~°Èû©m¦W¦Ó±oª¾·~°Èû¥N¸¹¡H
¦Ñ©Çµª¡G
¦b¦V Combo ¼W¥[·~°Èû©m¦W®É¡A§Y§Q¥Î Combo.ItemData Äݩʧâ·~°È¥N¸¹¥[¶i¥h¡A¤~¯à¦b Combo_Click ®É¡Aª½±µÅª¨ú·~°Èû¥N¸¹¡A¦Ó¤£»Ý¦A Seek ¤@¦¸¡C
±H¥óªÌ: Dino
½Ð±Ð¦p¦ó±N SQL ¸ê®Æ®w¤º®eÂনACCESSªº.mdbÀÉ¡H
¦Ñ©Çµª¡G
ÛÛ~½Ö®³§Úªº¥úºÐ:(~) ¼¶¼g©ó¤å³¹
½Ð°Ý SQLªº¦r¦ê¬O¥Î³æ¤Þ¸¹' ®Ø°_¨Óªº¡A¦ý¦pªG§Ún¿é¤J¬Y¤@¦r¦ê,¨ä¤¤¥]§t¤F³æ¤Þ¸¹ [']¡A¦p¦¹...¦r¦ê¤¤ªº ['] ´N·|³y¦¨¿ù»~...¡A¦³¨S¦³¤°»ò¸Ñ¨M¿ìªk??
¦Ñ©Çµª¡G
¥i¥H¥Î Chr() ¨ç¼Æ°t¦X Ascii ¦r½X¸Ñ¨M¡A
"It" & Chr(39) & "s not difficult"