Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 12th, 2006, 08:18 AM
Authorized User
 
Join Date: Jul 2006
Location: Bloemfontein, Freestate, South Africa.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populate a field

Hi Everyone

I don’t have that much VB experience, maybe someone can help me. I have 4 variables called: A, B, C and Z, what I want to do is update Z with the value of A when A is not blank and B and C is blank, other wise if A and B is both not blank and C is blank then Z should be updated with B's value and so on, the table's name is TBL. Below is the code that I have tried and failed, could someone please help me?


Private Sub Command0_Click()
Dim A As String
Dim B As String
Dim C As String
Dim Z As String

A = [TBL].[A]
B = [TBL].[B]
C = [TBL].[C]
Z = [TBL].[Z]

    If (A Is Not blank And B Is blank And C Is blank) Then Z = (A)
End If
End Sub


Thanks
Hennie



Reply With Quote
  #2 (permalink)  
Old September 13th, 2006, 08:27 AM
Authorized User
 
Join Date: Jul 2006
Location: Bloemfontein, Freestate, South Africa.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Does anyone have an idea for me?

Reply With Quote
  #3 (permalink)  
Old September 13th, 2006, 12:32 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

How do you want to do this? Do you want it to happen when someone fills out a form, or are you trying to update lots of records in an Update query, etc?

It would be easy in an update query on the table. You could do this in a series of Update queries just to make it very easy:

Update query:
A criteria: <>""
B criteria: <>""
C criteria: =""
Z update: [A]

Then just run the query.

Does this help?






mmcdonal
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create a View "Name" field & Populate bren582 SQL Server 2005 2 February 11th, 2008 10:28 PM
Populate field names upon selection from 1st DDL? InsouciantCoquette Classic ASP Databases 0 February 26th, 2006 11:23 PM
How can I auto-populate two MS Word document field kenn_rosie ASP.NET 1.0 and 1.1 Basics 0 February 15th, 2006 03:59 AM
Populate Auto-Number Field JeffGirard Access 2 August 26th, 2005 06:49 AM
Auto Populate a field ? mar0364 Classic ASP Databases 4 July 9th, 2004 11:10 AM



All times are GMT -4. The time now is 05:09 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.