use the Ucase$ function to convert a character to its lower case equivalent.
eg stName & "." & Ucase$(stAchar)
use the Ucase$ function to convert a character to its lower case equivalent.
eg stName & "." & Ucase$(stAchar)
In the Unload event of the form set the valve to Close then use End to terminate the program.
You need to get a username, either display a dialog box and prompt for the user to type it in or retrieve the windows username.
Retrieve the record from the database as follows:
Set Type_rs = db.OpenRecordset("SELECT * FROM User_Tab Where UserName = '" & stUserName & "'; ")
Now do your select statement as above
You need to add a button with a title of something like "Book Room". the code goes in the click event
public function calcPoints(booksRead as integer) as integer
dim points as integer
dim booksRemaining as integer
Points = 0
booksRemaining = booksRead
if booksRemaining > 0 then
points = min(booksRemaining,3) * 10
booksRemaining = booksRemaining - 3
end if
if booksRemaining >0 then
points = points + min(booksRemaining,3) * 15
booksRemaining = booksRemaining - 3
end if
if booksRemaining > 0 then
points = points + booksRemaining * 20
booksRemaining = 0
end if
calcPoints = points
end function
You can try experimenting with this, it might need some playing with to get it working
Dim thiscombar As CommandBar
For Each thiscombar In Application.CommandBars
thiscombar.Visible = False
Next thiscombar
perhaps ???
pbat.value = Trim(Text1.Text) & "%"
UPDATE Rooms SET Rooms.meta_keyword = Replace([meta_keyword],",",", ");
SELECT TransInfo.CustNo, Sum(IIf([RPTDate]=" 5/28/2010",[TransYTD]*-1,[TransYTD])) AS CombinedTrans FROM TransInfo GROUP BY TransInfo.CustNo;
The former is a better design however Profile should really be Person and you don't need two teacher tables
Person
PersonId (pk)
LastName
FirstName
Tel
Teacher
TeacherId (Pk)
PersonId (Fk)
TeacherQuals
Student
StudentId (Pk)
PersonId (fk)
Private Sub cmdBook_Click()
On Error GoTo Err_cmdBook_Click
Dim rsRoomBookings As Recordset
Set rsRoomBookings = CurrentDb.OpenRecordset("SELECT * FROM RoomBookings WHERE BookingDate='" & Format$(Me.DesiredDate, "dd-mmm-yyyy") & "' AND BookingTime='" & Format$(Me.DesiredTime, "hh:nn") & "' AND RoomName='" & Me.cboDesiredRoom & "'")
If rsRoomBookings.RecordCount > 0 Then
MsgBox "I am sorry that room is booked at that time already"
Else
CurrentDb.Execute "INSERT INTO RoomBookings (BookingDate, BookingTime, RoomName, BookedTo) VALUES('" & Format$(Me.DesiredDate, "dd-mmm-yyyy") & "', '" & Format$(Me.DesiredTime, "hh:nn") & "', '" & Me.cboDesiredRoom & "', '" & Me.PersonName & "');"
MsgBox "Booked"
Exit_cmdBook_Click:
Exit Sub
Err_cmdBook_Click:
MsgBox Err.Description
Resume Exit_cmdBook_Click
End Sub
I am not sure why you are doing the filtering in a second step
Private Sub OpenSeizureForm()
dim stFilter as String
If Me.NewRecord Then
'Open form in dataentry mode
DoCmd.OpenForm "Seizures", acNormal, , , acFormAdd, acWindowNormal, Me.incidentNum & "&Episode"
Else
' open and filter form
stFilter = "[IncidentNum] = '" & Me.[incidentNum] & "' And [SourceTable] = 'Episode'"
DoCmd.OpenForm "Seizures", acNormal, , stFilter, , acWindowNormal, Me.incidentNum & "&Episode"
End If
End Sub
Private Sub Form_Load
Dim argSplit() As String
argSplit = Split(CStr(Me.OpenArgs), "&")
'Set the DefaultValue which means new records will have these values
Me.txtIncidentNum.DefaultValue = CStr(argSplit(0))
Me.sourceTable.DefaultValue = CStr(argSplit(1))
End Sub
TeachLoad is a calculated field, so delete the first "teach.TeachLoad," and delete "teach." after the AS. also I suspect your final field reference in the join should be Staff.StaffNo=Semester.StaffNo.
You cannot do this as autonumber, it utilises a long integer data type. If you are adding the data using a form you can add code to the Before_Insert event to generate the number for you.
if you moved to SQL-Server for the database engine you could add a trigger to the database to achieve the same thing at the database level.
what do you want to search, table, the file system, a list box?
If you change the way you are thinking about the problem. Lets say you can only fit 5 text boxes in the frame. Then you only have 5 text boxes. As the user scrolls up or down simply change the captions and contents of the text boxes in the frame. YOu will need to keep track of which data is currently being displayed but you can do this via the captions.
so when you enter 20000 what ends up in the text field, and what is the mask you are using
I don't think it is code, you need to check the table definition and ensure your programme is complying with the rules defined in it.
what is the field type you are storing in. It should be text if you want the exact pattern stored.
I am guess there is a key violation, or some other data validation error, ie you are not entering data in a field marked as mandatory in the table. so the record is not being saved.
Go through the table definition an check each field to ensure you know all of the required fields etc
If you don't want to reflect the character int the textbox set the KeyCode variable to 0 in the form_keydown event
Cavern, your code is OK except that you need an Exit Sub between lines 2 & 3
Also you don't strickly need the "= True" on line 1 since BOF returns a boolean value
use .Find method to look to see for a record with the same value
the .NoMatch property will tell you whether the record exists or not
Setting the KeyPreview property of the Form will enable the Form to process the KeyDown event before any controls on the form do.
If you are using the SQL, you may like to investigate using the RecordsAffected property to determine whether the row was deleted and inform the user accordingly.
I am guessing you are not in the C: root when you execute, ie the TestFolder is being created under the folder you are in when execute.
"N" & format$(val(right$(SerialNo,4))+1,"0000")
The audit trail should be a separate table. if you put it in the main table you will only be able to keep the last transaction. It should have
User, DateTime, transaction details.
You can put in a separate form to view the contents of the table and restrict it to the manager only. Audit trails are often held in a different database on a different disk drive.
Andre provided you with the basic solution, if you are to learn it is necessary for a little bit of thinking and extrapolation by you.
you could add an audit trail, keep track of who did which transactions when.
Presumeably you are reading it into an integer variable, which, when you print it will be displayed, by default, in decimal
Find code below however this may not be the best way of achieving what you want.
In the LostFocus event, you can check if they have entered a valid date as follows
if not isdate(text1.text) then
msgbox "Please enter a valid date"
text1.setfocus
text1.selstart = 0
text1.sellength = len(text1.text)
end if
however if you want to stick to your original here is the code.
Private Sub Text1_KeyPress(KeyAscii As Integer)
Keyascii = CheckChar(KeyAscii)
end sub
public function CheckChar(KeyAscii as integer) as integer
Dim ch As String
CheckChar = KeyAscii
ch = Chr$(KeyAscii)
If Not ( _(ch >= "0" And ch <= "9") Or _KeyAscii = 8 Or _KeyAscii = 13 Or _KeyAscii = 84 Or _KeyAscii = 116 Or _KeyAscii = 47) Then ' Cancel the character.
CheckChar = 0
End If
If KeyAscii = 116 Or KeyAscii = 84 Then
CheckChar= 0
End If
end function
In line
Set rsTesteSQL = DBTesteSQL.OpenRecordset("SELECT * FROM test", dbOpenTable, 0, dbOptimistic)
dbOpenTable applies to Jet databases only. Try dbOpenDynaset instead.
You want to be careful doing this, it can put quite a strain on the database in a multiuser environment causing performance issues.
Order your table by LastName and use a find first to locate the first row that matches rather than requerying the table with each keystroke.
Replace first line with
Dim arrWhite(rs.Fields.Count - 1) As Double
Hard to say without fiddling with it.
Was the reference in a query that was specified as the source for the form? If so you were probably trying to access the object before it had been instanciated.
if you are being prompted for "Forms!f_TopicSelect!cboTopics" then it does not recognise it as an object. To cut to the chase, here is what I think you want to achieve.
Create a tabular form to display notes and topics from the notes table using the form wizard. In design view add an unbound combo box that populates the list from the topics table. In the click event add the following code.
Private Sub Combo6_Click()
Me.Filter = "Topic='" & Me.Combo6.Text & "'"
Me.FilterOn = True
End Sub
If you want to go low level and have a printer direct connected to the a printer port (no idea how it handles USB) you can write to it directly as follows
Open "PRN" For Output As #1
Print #1, "Here is line one"
Print #1, "Here is a text box " & Text1.Text
Close #1
Just delete them, contol the whole thing from the 3 integer variables, or if you are after a quick and dirty solution simply change their .visible property to False. That way you don't need to worry about stray references to them causing problems.
If you are only interested in valid combinations then it is more user friendly to restrict the population of the second combo
RS.Open "SELECT UNIQUE FirstName FROM tblrecords WHERE LastName='" & combo1.Text & "'", cn, adOpenStatic, adLockOptimistic
Also using the UNIQUE keyword will return only one instance of each name in the combo box instead of, say, 50 instances of "Chris". Same goes for the SELECT statement for Combo1
further to earlier comment see attached screen capture for example
Well if you added a unique compound key on A, B, C then it would prevent further rows being added that violates this rule. However that does not address the issue of the existing data that violates this rule.
That is not my understanding. A bound textbox displays the data at the cursor, ie the current row in the datagrid.
Have you tried binding the text box to a column in the datasource that supplies the datagrid.
Inside the if/then you should set
KeyAscii = 0
since you have handled it. however I don't think that will fix your error. have you tried hitting the Tab key and seeing what happens. Have a look at what is next in the tab order after the text box,
Why not add a command button that has code something like.
Hours = 2
Minutes = 0
Seconds = 0
Time = TimeSerial(Hours, Minutes, Seconds)
Text1.Text = "2"
Text2.Text = "0"
Text3.Text = "0"
Timer1.enabled = true
also at line 84 why not say
if label1.caption <> "00:00:00" then
This seems strange when I click "no" it does not append. You can handle it manually if you wish which will overcome the problem.
If MsgBox("are you sure you want to append these records", vbYesNo) = vbYes Then
DoCmd.SetWarnings False
DoCmd.OpenQuery "Query4"
DoCmd.SetWarnings True
End If
SELECT a, Count(a) AS CountOfa1 FROM (SELECT Table1.a, Table1.b, Table1.c, Count(Table1.a) AS CountOfa FROM Table1 GROUP BY Table1.a, Table1.b, Table1.c) GROUP BY a;
This will return the number of combinations of "b" and "c" for each "a"