ToshTrent
Technical User
- Jul 27, 2003
- 209
Private Sub txtPubCode_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then MsgBox "Enter"
End Sub
Hi what in the code below would stop the section above working?
Private Sub Form_Load()
Dim DirectoryTest As String
Dim iResponse As Integer
'Set Contents and Properties of Fixed Information Fields
lblUserName.BackStyle = 0 'Clears background
lblRequestDate.BackStyle = 0 'Clears background
lblUserName = User 'Displays Windows User Name
lblRequestDate.Caption = Format(Date, "dd/mm/yyyy" 'Displays date in Format
cboPublishers.AddItem "No Publishers Present"
cboMagazines.AddItem "No Magazines Present"
DirCheck:
DirectoryTest = Dir(DatabaseLocation)
If DirectoryTest = "" Or DatabaseLocation = "" Then
iResponse = MsgBox("Unable to locate Database, would you like to specify one now?", vbQuestion + vbYesNo, "Database Not Found"
If iResponse = vbYes Then frmConfigure.Show vbModal
If iResponse = vbNo Then Exit Sub 'Stop loading the form to prevent errors
GoTo DirCheck 'Repeat the directory check
End If
'Set New Record Sets and Connection
Set DBcn = New ADODB.Connection
Set rs = New ADODB.Recordset
DBcn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " & DatabaseLocation & ";"
'Defines what table and field to retrive the information from
rs.Open "SELECT * FROM tbl_Client_Details", DBcn, adOpenStatic, adLockReadOnly, adCmdText
'Clears the combo
cboPublishers.Clear
'Repeats until all records have been added
Do Until rs.EOF
cboPublishers.AddItem UCase(rs.Fields("Client_Name")
cboPublishers.ItemData(cboPublishers.ListCount - 1) = rs.Fields("client_Auto_ID"
rs.MoveNext
Loop
rs.Close 'Closes the recordset
cmdSave.Enabled = True 'Enables the save button to allow saving to the database
End Sub
[red]
Thankyou[/red]
Matt
If KeyAscii = 13 Then MsgBox "Enter"
End Sub
Hi what in the code below would stop the section above working?
Private Sub Form_Load()
Dim DirectoryTest As String
Dim iResponse As Integer
'Set Contents and Properties of Fixed Information Fields
lblUserName.BackStyle = 0 'Clears background
lblRequestDate.BackStyle = 0 'Clears background
lblUserName = User 'Displays Windows User Name
lblRequestDate.Caption = Format(Date, "dd/mm/yyyy" 'Displays date in Format
cboPublishers.AddItem "No Publishers Present"
cboMagazines.AddItem "No Magazines Present"
DirCheck:
DirectoryTest = Dir(DatabaseLocation)
If DirectoryTest = "" Or DatabaseLocation = "" Then
iResponse = MsgBox("Unable to locate Database, would you like to specify one now?", vbQuestion + vbYesNo, "Database Not Found"
If iResponse = vbYes Then frmConfigure.Show vbModal
If iResponse = vbNo Then Exit Sub 'Stop loading the form to prevent errors
GoTo DirCheck 'Repeat the directory check
End If
'Set New Record Sets and Connection
Set DBcn = New ADODB.Connection
Set rs = New ADODB.Recordset
DBcn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source= " & DatabaseLocation & ";"
'Defines what table and field to retrive the information from
rs.Open "SELECT * FROM tbl_Client_Details", DBcn, adOpenStatic, adLockReadOnly, adCmdText
'Clears the combo
cboPublishers.Clear
'Repeats until all records have been added
Do Until rs.EOF
cboPublishers.AddItem UCase(rs.Fields("Client_Name")
cboPublishers.ItemData(cboPublishers.ListCount - 1) = rs.Fields("client_Auto_ID"
rs.MoveNext
Loop
rs.Close 'Closes the recordset
cmdSave.Enabled = True 'Enables the save button to allow saving to the database
End Sub
[red]
Thankyou[/red]
Matt