×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Need to assign values to text boxes.

Need to assign values to text boxes.

Need to assign values to text boxes.

(OP)
I am a new user to access/vBA.  I have a script that prompts the user to enter a Student ID.  The Student ID that is entered is compared with all the students in the database and outputs in the form of a message box.  The problem is that I want to output these fields... (i.e. Student_Last_Name, Student_First_Name, Address) in separate text boxes.  I have created a new form with unbound text boxes and now I don't know how to adjust the code to ouput to the unbound text boxes... I would appreciate any help on this. Thanks!  I have pasted the code below:

Function Command0_Click()
'On Error GoTo Err_Command0_Click
    Dim retval As Variant
    
    retval = InputBox("Enter student ID", "Student ID", "")
    
    Dim db As Database, rst As Recordset, SQL As String
    Set db = CurrentDb
    ' SQL string.
    SQL = "SELECT * FROM Student WHERE Student_ID = '" & retval & "';"
    Set Student = db.OpenRecordset(SQL)
    If Student.RecordCount > 0 Then
        MsgBox "Found Student " & Student!Student_ID & " - " & " " & Student!S_L_Name & " " & Student!S_F_Name, vbInformation, "Found Student"
       
    Else
        MsgBox "Student ID " & retval & " Not found!!!", vbExclamation, "Missing student ID"
    End If
    
    Student.Close
    db.Close
    
Exit_Command0_Click:
    Exit Function

Err_Command0_Click:
    MsgBox Err.Description
    Resume Exit_Command0_Click
    
End Function

RE: Need to assign values to text boxes.

(OP)
Figured out my own question... Thanks!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close