I dont know why I cant pass the value of AccountType (from TblAccount) to Me.txtWAccounType(textbox from WithdrawView)
pls help me.. here's my code - If IsNull(DLookup("[AccountId]", "TblAccount", "AccountId = '" & txtWAccountId & "'")) Then
-
MsgBox "Account Number Doesn't Exist"
-
-
Else
-
Me.txtWAccounType.Value = DLookup("[AccountType]", "TblAccount", "AccountId = ' " & Forms![WithdrawView]![txtWAccountId] & "' ")
-
MsgBox "Account Number Do Exist"
-
-
End If
-
my goal is to retrieve that AfterUpdate of AccountId. messagebox"Account Number Do Exist" pop up so it means there is a value but why it doesn't appear in Me.txtWAccounType.
pls help.. thank you.
Lets see if I can narrow down where the problem is. Above the code that you posted, put in the following: - Dim strResult as String
-
strResult = DLookup("AccountID", "TblAccount", "AccountID =" & txtWAccountID)
Then, in line 5 of what you posted, replace the DLookup... with strResult.
Now click in the gray area next to that line of code (while in the VBA editor). A red dot should appear. Now do whatever is required to make your code execute. The code will stop at the line with the red dot. Now press Ctrl+G to make the Immediate window appear. Type into the immediate window
What do you get?
11 1502
Something that I just noticed is that in line 5, it looks like you left out a T in Me.txtWAccounType. Just a guess. If that fixes it, then you can ignore the rest of this post.
Your DLookup should be like this: - DLookup("AccountID", "TblAccount", "AccountID =" & txtWAccountID)
The name AccountID makes me think that the value is a number, in which case you don't want the ' surrounding it. Also, in line 5, I'm assuming that the active form is WithdrawView since in line 1 you left off the Forms!WithdrawView! before the control name. If I'm wrong, then you would need to add it back on to the code that I posted. Also in line 5, you don't need the .Value. All you need is
Thank you. I did your suggestion but the textbox value is still null. I didn't get any error message and the messagebox"Account Number Do Exist" only proves that there is a value found but why it doesn't appear on my textbox? anyway AccountID is a string
example : 20091S
Thank you so much..
Lets see if I can narrow down where the problem is. Above the code that you posted, put in the following: - Dim strResult as String
-
strResult = DLookup("AccountID", "TblAccount", "AccountID =" & txtWAccountID)
Then, in line 5 of what you posted, replace the DLookup... with strResult.
Now click in the gray area next to that line of code (while in the VBA editor). A red dot should appear. Now do whatever is required to make your code execute. The code will stop at the line with the red dot. Now press Ctrl+G to make the Immediate window appear. Type into the immediate window
What do you get?
Sir Do you have other suggestion on how can i get table field value and put it in the textbox (as a part of searching the record) where the values to be inserted on the textbox depends upon the AccountID?
thank you so much..
Rheigny,
Are txtWAccountId and Forms![WithdrawView]![txtWAccountId] supposed to be the same control on the same form? If so, then your code could look like this: -
If IsNull(DLookup("[AccountId]", "TblAccount", "AccountId = '" & Me.txtWAccountId & "'")) Then
-
MsgBox "Account Number Doesn't Exist"
-
-
Else
-
Me.txtWAccounType.Value = DLookup("[AccountType]", "TblAccount", "AccountId = ' " & Me.txtWAccountId & "'")
-
MsgBox "Account Number Do Exist"
-
End If
Syntax for references to forms must be pretty exact....
There's an error now after i did your suggestion its
Run-time error "3075":
Syntax error (missing operator) in query expression 'AccountID = 20091S'
and highlight this - strResult = DLookup("AccountID", "TblAccount", "AccountID =" & txtWAccountId)
? strResult
20091S
Here's what I get from immediate window sir.
You forgot the single quote to designate a String... -
strResult = DLookup("AccountID", "TblAccount", "AccountID ='" & txtWAccountId & "'")
Wow sir It's working! Thank you so much!
My pleasure! Glad we could assist you today!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: velu |
last post by:
Problem in getting value from textbox & radiobuttonlist to a valuable inside
a datagid.
I want to insert a record into a table thru datagrid. Here is the code (see
below)
Private Sub...
|
by: Mark |
last post by:
Hello -
From an Access VBA module, I'm trying to pass a Table to a VB.Net class.
I'm getting the following error running the VBA:
"Unable to cast object of type System._ComObject to type...
|
by: rudranee |
last post by:
Hi everyone,
I want to know how can i edit a value in textbox in html .
I have a field where I have already put a value from database but i
also want to edit it .
for example ,if in a textbox i...
|
by: startsmart |
last post by:
Hi
This is first time to write and alse it is first time to show this site
my problem is i need to pass value from any input type like text for example
to hidden field
I tried to make a...
|
by: Chris |
last post by:
I created a very simple web page in asp.net.
there are only a textbox and a button on the page. when the page loads into
web browser there is current date in the textbox. but the date can be...
|
by: colleen1980 |
last post by:
Hi: Can any one please tell me that how to i pass the two textbox
values in the new page. If i use the form action in the popup window
page then the new page is open in the same popup window as i...
|
by: abirami elango |
last post by:
Hi,
i have created a web application in vb.net.
i have assigned a value to the textbox during page UNLOAD event as below..
.........
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As...
|
by: adepvivek |
last post by:
Hi everybody,
I am using textbox in gridview as template. And I want to stored the value of textbox. For that I want to pass the textbox value to stored procedure.
So please give me solution.
|
by: happyse27 |
last post by:
Hi All,
my html code is sno 1) and perl code is sno 2).
a) I tried to print $filename and it cant print out the value, only blank was displayed, and the file could not be uploaded. And it...
|
by: ajax.sam |
last post by:
hi all, i got 2 questions! i want to do these:
1. select @col1 from some_table where <some_conditions>; I can pass
parameters by using Parameters.Add for <some_conditionsbut not for
the @col1....
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |