By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,827 Members | 2,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,827 IT Pros & Developers. It's quick & easy.

Validating data on 1 form before displaying the next form

P: 5
hi,
Please I need this information (so important)


I use access and If my query likes this:

Fields name
Criteria [Enter the Name]

And I linked it to Form 1 (the user enter the name)
My Question is how to restrict the user to enter only name that in the table, and if it was not the Form 2 will not open and the system will give an error message?

Query ==> Form 1(the user enter the name) ==> Form 2(the information of that name)
I am wating for any replay
Jan 15 '07 #1
Share this Question
Share on Google+
10 Replies


10K+
P: 13,264
hi,
Please I need this information (so important)


I use access and If my query likes this:

Fields name
Criteria [Enter the Name]

And I linked it to Form 1 (the user enter the name)
My Question is how to restrict the user to enter only name that in the table, and if it was not the Form 2 will not open and the system will give an error message?

Query ==> Form 1(the user enter the name) ==> Form 2(the information of that name)
I am wating for any replay
Perhaps you should post in the access forum
Jan 15 '07 #2

Banfa
Expert Mod 5K+
P: 8,916
I have moved you post to the Access forum where you are more likely to get a reply and given it a more meaningful title.
Jan 15 '07 #3

markmcgookin
Expert 100+
P: 648
hi,
Please I need this information (so important)


I use access and If my query likes this:

Fields name
Criteria [Enter the Name]

And I linked it to Form 1 (the user enter the name)
My Question is how to restrict the user to enter only name that in the table, and if it was not the Form 2 will not open and the system will give an error message?

Query ==> Form 1(the user enter the name) ==> Form 2(the information of that name)
I am wating for any replay
Sorry, I am not quite sure what you are looking for. Could you be a bit clearer?

Is it some form of login script? (I'm a big fan of pseudocode!)

Like the user enters data on form 1

if the data is "x" go to form 2

OR If the data is "y" go to form 3

OR If the data >< x and >< y display error?
Jan 15 '07 #4

P: 5
Thanks every body for your response

I do not use the VBA, I use the macros.

I have Form1 which has command button, when click it will open the Form2 which is built based on Query. This query has 2 fields {ID and Name} the criterion is under the Name field. The criteria asked (after clicking the button in Form1) the user to enter the Name that he need to show in Form2.In my case the form2 will open all the time if the Name in the query the Form2 will show it, and if it was not on the query also Form2 will open empty.

How to, make Form2 open only if the Name is in query and if not it will give me error message?

My Regards,
Jan 16 '07 #5

markmcgookin
Expert 100+
P: 648
I do not use the VBA, I use the macros.
Hi I am not sure if this is possible using only macros I think you will need to implement a level of VBA for validation, like that mentioned above. I could however be wrong. I generally only use macros for simple form functions like open, close maximise.
Jan 16 '07 #6

P: 5
hi,

OK, if I do it using VBA. How I can do it ?

My Regards
Jan 17 '07 #7

P: 5
hi,
I wrote this code but is not working.


Private Sub a_Click()
On Error GoTo Err_a_Click

Dim stDocName As String
Dim name As String


stDocName = "Form2"

If name = qw Then
DoCmd.OpenForm stDocName, acNormal

Else
MsgBox "Error!!! try again"
End If

Exit_a_Click:
Exit Sub

Err_a_Click:
MsgBox Err.Description
Resume Exit_a_Click
End Sub

PLEASE I NEED HELP VERY IMPORTANT
Jan 17 '07 #8

P: 9
in ACCess I hope you know that we can add controls to the form. In this sense we can add combo contorl in the form and just link the field name . then you no need to care about the user name entry.
Jan 17 '07 #9

P: 5
Hi,

I solved the problem thank you everyone.


My Regards,
Jan 22 '07 #10

markmcgookin
Expert 100+
P: 648
Hi,

I solved the problem thank you everyone.


My Regards,

Hi Glad to hear you got it working, sorry I didn't reply I was away for a few days. Any chance you could post your code solution for other people with similar problems?
Jan 23 '07 #11

Post your reply

Sign in to post your reply or Sign up for a free account.