Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

bgreen (Programmer) (OP)
16 May 07 13:15
Hi,

I want to assign a variable to a value retaine in a table.  I am unsure how to do this.

sUID = "SELECT tblTransferInfo.User FROM tblTransferInfo;"
      
MsgBox "UID: " & sUID

I want the value for the Field User to display.
Helpful Member!  PWise (Programmer)
16 May 07 13:19
dlookup("User ","tblTransferInfo")
bgreen (Programmer) (OP)
16 May 07 16:15
Beauty!  Works perfect.  Thanks!
davidd31415 (Programmer)
18 Jun 07 12:48
How about the opposite?

I'd like to set a field in the table that is the recordsource of the form i'm using so that

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

will save the field set in the vba code as well.

I've used the DAO.Database,RecordSet,and Field objects with .AddNew and .Update but I'm hoping I can do this in one line since the field is in the form's recordset table.

Thanks,

David
davidd31415 (Programmer)
18 Jun 07 13:08
Figured it out- put the field name in brackets.

If I want to set the field Username to the variable sUsername I can do so as follows:

Dim sUsername As String
sUsername = Environ("username")  'retrievs login name
[Username] = sUsername 'example of setting field to a variable

David

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!

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