PC Review


Reply
Thread Tools Rate Thread

code gone wrong when trying to make an automated form

 
 
=?Utf-8?B?RGF3blRyZWFkZXI=?=
Guest
Posts: n/a
 
      25th Oct 2006
hello

the problem is that everytime i open my spreadsheet the dialog i created to
open at the begining pops up. that is exactly what i want it to do, but i
only want to do it once. the reason is that once you open it again after
saving you have the popup come up and then you have to enter the information
for specific cells again.

here is my code that is giving me trouble. the popup doesnt show at all.
whether the cell b5 is empty or not.

Private Sub Workbook_Open()
Dim USRNM As String

USRNM = Range("b5").Select

If IsNull(USRNM) Then
TimeCardInfo.Show
End If

End Sub


here is all the other code for the project. just incase there is something
that is causing the problem there. this code is attached to the user form i
have created to popup whenever the book is opened.

Private Sub Ok_Click()

Range("b5").Select
ActiveCell.Value = UserName
Range("e5").Select
ActiveCell.Value = EmployNumber
Range("a11").Select
ActiveCell.Value = Enterdatebox
Range("b8").Select

Hide
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = vbFormControlMenu Then
Cancel = True
MsgBox "Please use the OK button after entering required data!"
End If
End Sub

if anyone can offer a sugestion as to how to make it only popup if the cell
b5 is blank that would be great!


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      26th Oct 2006
USRNM = Range("b5").Select
should be
USRNM = Range("b5").Value ' or .text???

And check it with:

If USRNM = "" Then

DawnTreader wrote:
>
> hello
>
> the problem is that everytime i open my spreadsheet the dialog i created to
> open at the begining pops up. that is exactly what i want it to do, but i
> only want to do it once. the reason is that once you open it again after
> saving you have the popup come up and then you have to enter the information
> for specific cells again.
>
> here is my code that is giving me trouble. the popup doesnt show at all.
> whether the cell b5 is empty or not.
>
> Private Sub Workbook_Open()
> Dim USRNM As String
>
> USRNM = Range("b5").Select
>
> If IsNull(USRNM) Then
> TimeCardInfo.Show
> End If
>
> End Sub
>
> here is all the other code for the project. just incase there is something
> that is causing the problem there. this code is attached to the user form i
> have created to popup whenever the book is opened.
>
> Private Sub Ok_Click()
>
> Range("b5").Select
> ActiveCell.Value = UserName
> Range("e5").Select
> ActiveCell.Value = EmployNumber
> Range("a11").Select
> ActiveCell.Value = Enterdatebox
> Range("b8").Select
>
> Hide
> End Sub
>
> Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
> If CloseMode = vbFormControlMenu Then
> Cancel = True
> MsgBox "Please use the OK button after entering required data!"
> End If
> End Sub
>
> if anyone can offer a sugestion as to how to make it only popup if the cell
> b5 is blank that would be great!


--

Dave Peterson
 
Reply With Quote
 
=?Utf-8?B?RGF3blRyZWFkZXI=?=
Guest
Posts: n/a
 
      26th Oct 2006
Hello

k, will try this thanks!

"Dave Peterson" wrote:

> USRNM = Range("b5").Select
> should be
> USRNM = Range("b5").Value ' or .text???
>
> And check it with:
>
> If USRNM = "" Then
>
> DawnTreader wrote:
> >
> > hello
> >
> > the problem is that everytime i open my spreadsheet the dialog i created to
> > open at the begining pops up. that is exactly what i want it to do, but i
> > only want to do it once. the reason is that once you open it again after
> > saving you have the popup come up and then you have to enter the information
> > for specific cells again.
> >
> > here is my code that is giving me trouble. the popup doesnt show at all.
> > whether the cell b5 is empty or not.
> >
> > Private Sub Workbook_Open()
> > Dim USRNM As String
> >
> > USRNM = Range("b5").Select
> >
> > If IsNull(USRNM) Then
> > TimeCardInfo.Show
> > End If
> >
> > End Sub
> >
> > here is all the other code for the project. just incase there is something
> > that is causing the problem there. this code is attached to the user form i
> > have created to popup whenever the book is opened.
> >
> > Private Sub Ok_Click()
> >
> > Range("b5").Select
> > ActiveCell.Value = UserName
> > Range("e5").Select
> > ActiveCell.Value = EmployNumber
> > Range("a11").Select
> > ActiveCell.Value = Enterdatebox
> > Range("b8").Select
> >
> > Hide
> > End Sub
> >
> > Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
> > If CloseMode = vbFormControlMenu Then
> > Cancel = True
> > MsgBox "Please use the OK button after entering required data!"
> > End If
> > End Sub
> >
> > if anyone can offer a sugestion as to how to make it only popup if the cell
> > b5 is blank that would be great!

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
=?Utf-8?B?RGF3blRyZWFkZXI=?=
Guest
Posts: n/a
 
      26th Oct 2006
Hello

you rock!

that worked great.

i used ".value" and it does exactly what i wanted. thanks so much.

"Dave Peterson" wrote:

> USRNM = Range("b5").Select
> should be
> USRNM = Range("b5").Value ' or .text???
>
> And check it with:
>
> If USRNM = "" Then
>
> DawnTreader wrote:
> >
> > hello
> >
> > the problem is that everytime i open my spreadsheet the dialog i created to
> > open at the begining pops up. that is exactly what i want it to do, but i
> > only want to do it once. the reason is that once you open it again after
> > saving you have the popup come up and then you have to enter the information
> > for specific cells again.
> >
> > here is my code that is giving me trouble. the popup doesnt show at all.
> > whether the cell b5 is empty or not.
> >
> > Private Sub Workbook_Open()
> > Dim USRNM As String
> >
> > USRNM = Range("b5").Select
> >
> > If IsNull(USRNM) Then
> > TimeCardInfo.Show
> > End If
> >
> > End Sub
> >
> > here is all the other code for the project. just incase there is something
> > that is causing the problem there. this code is attached to the user form i
> > have created to popup whenever the book is opened.
> >
> > Private Sub Ok_Click()
> >
> > Range("b5").Select
> > ActiveCell.Value = UserName
> > Range("e5").Select
> > ActiveCell.Value = EmployNumber
> > Range("a11").Select
> > ActiveCell.Value = Enterdatebox
> > Range("b8").Select
> >
> > Hide
> > End Sub
> >
> > Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
> > If CloseMode = vbFormControlMenu Then
> > Cancel = True
> > MsgBox "Please use the OK button after entering required data!"
> > End If
> > End Sub
> >
> > if anyone can offer a sugestion as to how to make it only popup if the cell
> > b5 is blank that would be great!

>
> --
>
> Dave Peterson
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding a filter functionality to my database form. What's wrong withthat code? Lothar Behrens Microsoft C# .NET 1 12th Apr 2010 01:28 PM
Code mysteriously runs on wrong form mabl123456@hotmail.com Microsoft Access Form Coding 2 21st Aug 2008 11:38 PM
Code to make form Read Only dee Microsoft Access VBA Modules 6 11th Jan 2008 05:40 AM
Code goes to wrong form Sue McCain Microsoft Access VBA Modules 1 22nd Mar 2004 07:17 PM
What's wrong with this Form code ?? --Horizontal Mis-Alignment Mystery!!!-- tmb Microsoft Frontpage 3 17th Sep 2003 10:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:03 PM.