A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Need help in VBA Codes



 
 
Thread Tools Display Modes
  #21  
Old January 16th, 2006, 12:30 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Need help in VBA Codes

What you really need to do is to believe me when I say this is outside the
area on which I can effectively advise you. The other thing you need to do
is to include the rest of the thread in your reply to whoever responds. My
suggestion about the unbound text box was a bit of a guess, as I clearly
admitted. However, I can suggest something, which is to test whether the
GetAbbrevs value has any meaning in your code. You say that you have a text
box that has the code, but you refer to it in your description variously as
CODE and as txtCode. You go on to say that you have a text box that has the
code, but does it? First, make the text box Me.Code visible for now. You
can always hide it later. Next, in the form's Current event, put Me.Code =
GetAbbrevs. That's all. If you are getting the expected result in the text
box, then you can proceed with other experiments. If not, that's where you
need to start. If no go, I would within the GetAbbrevs function define the
result as a string (strAbbrev, or whatever), then I would (still within the
function) add a message box line of code: msgbox strAbbrevs. Call the
function from a command button, and see if you get the expected result in
the message box. If so, then you can get rid of the message box and try
passing the string (not the function name) to your code.

Better yet, start a new thread entitle something like Passing Function to
Query. Then, add the code you found to parse the text and extract the first
letter of each word. Include the statement about calling the function from
a query, and ask what that means. If you can get the result in a query it
would be a cleaner method than to use a hidden text box.

Whenever you are trying to define something like the result you are
expecting GetAbbrevs, test for the expected result by means of a message box
or text box or something before you write the rest of the code. I still
think the problem is that GetAbbrevs has no meaning in the context of an
event on the form.

"FA" wrote in message
oups.com...
I tried one more thing Bruce,
I made a unbound textbox called CODE which will not be vissible to the
user. In the On Current Event of the form i put
Me.CODE = GetAbbrevs(Me.SYS_NME) & "V"

Now in the OnClick event of the command button
i have something like this
Private Sub Command566_Click()


If Me.NewRecord Then
Dim strSysNumber, strATAR As String
Dim varResult As Variant

strSysNumber = "SYS_CODE Like """ & Me.CODE & "*"""

varResult = DMax("SYS_CODE", "dbo_SYS_INFO",
strSysNumber)

If IsNull(varResult) Then
Me.SYS_CODE = Me.CODE & "01"
Else
Me.SYS_CODE = Me.CODE &
Format(Val(Right(varResult, 2)) + 1, "00")
End If
End If
I was very sure that it would work because thats exactly what i am
doing in the Finding Number but nothing happen. Now i have a textbox
which has the CODE, why cant the function look the value in the txtCODE
and matches with the SYS_CODE in the table and pick the highest one and
add 1 to it.

I would really like this function to be working before monday because i
have a presentation on tuesday and i dont know if i can make it work.

Your reply would be highly appreciated.
Thanks
Moe
End Sub



  #22  
Old January 16th, 2006, 09:36 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Need help in VBA Codes

Thanks Bruce, its working now all i did was took out Me.Newrecord from
the code because its not a new record. Its working fine now. Thanks
again and sorry that i kept asking you. Next time i will listen to you
;-)

Thanks again

Moe

  #23  
Old January 17th, 2006, 12:04 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Need help in VBA Codes

Just be aware that the number will change if the user clicks the command
button. If you want the number to be a permanent part of the record, you
should probably disable or hide the command button except for new records,
or something of that sort.

"FA" wrote in message
ups.com...
Thanks Bruce, its working now all i did was took out Me.Newrecord from
the code because its not a new record. Its working fine now. Thanks
again and sorry that i kept asking you. Next time i will listen to you
;-)

Thanks again

Moe



  #24  
Old January 17th, 2006, 12:04 PM posted to microsoft.public.access.forms
external usenet poster
 
Posts: n/a
Default Need help in VBA Codes

Just be aware that the number will change if the user clicks the command
button. If you want the number to be a permanent part of the record, you
should probably disable or hide the command button except for new records,
or something of that sort.
Glad it's working. Good luck with your project.

"FA" wrote in message
ups.com...
Thanks Bruce, its working now all i did was took out Me.Newrecord from
the code because its not a new record. Its working fine now. Thanks
again and sorry that i kept asking you. Next time i will listen to you
;-)

Thanks again

Moe




 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Please give us REVEAL CODES like WORD PERFECT not reveal codes in. Rachel King General Discussion 39 August 21st, 2009 09:54 PM
How do I delete all XE codes? nin General Discussion 1 June 18th, 2005 01:24 AM
Query to look up a number of zip codes or area codes for bulk mail AceWill Running & Setting Up Queries 6 April 16th, 2005 04:38 AM
Input masks for postal codes (UK) in Access James General Discussions 4 February 14th, 2005 07:03 PM
Recorded Macro Codes, Contain Errors Tushar Mehta Charts and Charting 2 February 27th, 2004 10:03 PM


All times are GMT +1. The time now is 09:45 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.