Create Form from Query

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Create Form from Query

Post by adam »

I’m trying to create a form by creating a query from two tables when the form would have all the fields except the field "lngEmpID"

But I’m unable to create either a query or a relationship from both of the tables to create the specified form.

What is that I'm doing wrong in here?
You do not have the required permissions to view the files attached to this post.
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Form from Query

Post by HansV »

There is no reason to use two tables here. Place all fields that you need in one table.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Create Form from Query

Post by adam »

Thanks for the reply Hans.

Based upon your suggestion I’ve created a form to add and created logins for employees.

I have two text boxes for a user to add password where one is to create and the other is to confirm.

How could I create a message box which would say “The passwords do not match please type again” when a user mistakenly retypes a password that does not match the initial ?

Note: when the database is open it first shows a splash screen and then the login dialog. Pass for any name is 12345.
You do not have the required permissions to view the files attached to this post.
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Form from Query

Post by HansV »

Your form frmLogon contains only a single text box...
Best wishes,
Hans

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Form from Query

Post by HansV »

Sorry, you mean the form to add a new employee. Create a Before Update event procedure for the form:

Code: Select all

Private Sub Form_BeforeUpdate(Cancel As Integer)
  If Me.strEmpPassword <> Me.Confirm_PassWord Then
    Me.Confirm_PassWord.SetFocus
    MsgBox "Passwords do not match!", vbExclamation
    Cancel = True
  End If
End Sub
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Create Form from Query

Post by adam »

Thanks for the code. This version does not open up the splash screen automatically. I've exported the tables and forms to the database "DateQuery". Is this because of that?
You do not have the required permissions to view the files attached to this post.
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Form from Query

Post by HansV »

No, it's because no startup form has been set.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Create Form from Query

Post by adam »

How could it be done? According to me no code had been changed.
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Form from Query

Post by HansV »

There's no code involved.

Click the Office button in the upper left corner of the Access window.
Click "Access Options".
Select "Current Database" in the navigation pane on the left hand side.
In the "Application Options" section, "Display Form" is currently set to (none).
Select the frmStartup from the dropdown list.
Click OK.
Next time you open the database, frmStartup will automatically be displayed.
Best wishes,
Hans

User avatar
adam
SilverLounger
Posts: 2347
Joined: 23 Feb 2010, 12:07

Re: Create Form from Query

Post by adam »

Thanks for the help Hans. It does open now.
Best Regards,
Adam

User avatar
HansV
Administrator
Posts: 78487
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Create Form from Query

Post by HansV »

adam wrote:It does open now.
Of course! :wink:
Best wishes,
Hans