| Access - Ερωτήσεις / Απαντήσεις Access + VBA... Εδώ δεν υπάρχουν όρια! |
![]() |
| | Εργαλεία Θεμάτων | Τρόποι εμφάνισης |
| |
|
#1
| |||
| |||
| Καλησπέρα σε όλους και καλή Ανάσταση Ανοίγοντας όλες τις βάσης δεδομένων με πρωτεύον επιλογή τον πίνακα επιλογών μου εμφανίζει Error στον παρακάτω κώδικα στην υπογραμμισμένη σειρά. Όπια Βοήθεια δεκτή. Κώδικας: Private Sub FillOptions()
' Fill in the options for this switchboard page.
' The number of buttons on the form.
Const conNumButtons = 8
Dim con As Object
Dim rs As Object
Dim stSql As String
Dim intOption As Integer
' Set the focus to the first button on the form,
' and then hide all of the buttons on the form
' but the first. You can't hide the field with the focus.
Me![Option1].SetFocus
For intOption = 2 To conNumButtons
Me("Option" & intOption).Visible = False
Me("OptionLabel" & intOption).Visible = False
Next intOption
' Open the table of Switchboard Items, and find
' the first item for this Switchboard Page.
Set con = Application.CurrentProject.Connection
stSql = "SELECT * FROM [Switchboard Items]"
stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID]
stSql = stSql & " ORDER BY [ItemNumber];"
Set rs = CreateObject("ADODB.Recordset")
rs.Open stSql, con, 1 ' 1 = adOpenKeyset
' If there are no options for this Switchboard Page,
' display a message. Otherwise, fill the page with the items.
If (rs.EOF) Then
Me![OptionLabel1].Caption = "Äåí õðÜñ÷ïõí óôïé÷åßá ãéá áõôÞí ôç óåëßäá ðßíáêá åðéëïãþí"
Else
While (Not (rs.EOF))
Me("Option" & rs![ItemNumber]).Visible = True
Me("OptionLabel" & rs![ItemNumber]).Visible = True
Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
rs.MoveNext
Wend
End If
' Close the recordset and the database.
rs.Close
Set rs = Nothing
Set con = Nothing
End Sub
Τελευταία επεξεργασία από το χρήστη anestaki : 19-04-14 στις 00:53. |
|
#2
| |||
| |||
|
Δοκιμασε αυτο σε μενα δουλευει Private Sub FillOptions() ' Fill in the options for this switchboard page. ' The number of buttons on the form. Const conNumButtons = 8 Dim con As Object Dim rs As Object Dim stSql As String Dim intOption As Integer ' Set the focus to the first button on the form, ' and then hide all of the buttons on the form ' but the first. You can't hide the field with the focus. Me![Option1].SetFocus For intOption = 2 To conNumButtons Me("Option" & intOption).Visible = False Me("OptionLabel" & intOption).Visible = False Next intOption ' Open the table of Switchboard Items, and find ' the first item for this Switchboard Page. Set con = Application.CurrentProject.Connection stSql = "SELECT * FROM [Switchboard Items]" stSql = stSql & " WHERE [ItemNumber] > 0 AND [SwitchboardID]=" & Me![SwitchboardID] stSql = stSql & " ORDER BY [ItemNumber];" Set rs = CreateObject("ADODB.Recordset") rs.Open stSql, con, 1 ' 1 = adOpenKeyset ' If there are no options for this Switchboard Page, ' display a message. Otherwise, fill the page with the items. If (rs.EOF) Then Me![OptionLabel1].Caption = "Δεν υπάρχουν στοιχεία για αυτήν τη σελίδα πίνακα επιλογών" Else While (Not (rs.EOF)) Me("Option" & rs![ItemNumber]).Visible = True Me("OptionLabel" & rs![ItemNumber]).Visible = True Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText] rs.MoveNext Wend End If ' Close the recordset and the database. rs.Close Set rs = Nothing Set con = Nothing End Sub |
![]() |
« Προηγούμενο Θέμα
|
Επόμενο Θέμα »
| |
| ||||
| Θέμα | Δημιουργός | Forum | Απαντήσεις | Τελευταίο Μήνυμα |
| Ερωτήσεις πολλαπλών επιλογών σχετικά με την Access | Νικόλαος Μ | Access - Ερωτήσεις / Απαντήσεις | 3 | 21-06-15 02:43 |
| [Εκτύπωση] Εκτύπωση πολλών αρχείων, πολλών επιλογών | mak | Excel - Ερωτήσεις / Απαντήσεις | 7 | 11-06-12 12:34 |
| [Γενικά] Αντιγραφή επιλογών φίλτρου | PANIK | Excel - Ερωτήσεις / Απαντήσεις | 1 | 16-04-12 19:19 |
| [ Φόρμες ] Προσθήκη επιλογών σε σύνθετο πλαίσιο | gmax | Access - Ερωτήσεις / Απαντήσεις | 6 | 27-07-11 07:52 |
Η ώρα είναι 07:50.


Υβριδικός τρόπος

