Cant find the Answer...

zym1ne

Registered User.
Local time
Today, 23:26
Joined
Jul 25, 2003
Messages
34
Have searched everywhere for this one folks and no luck as yet...

I have a form at present with a cmd button that closes the current form opening a second that allows data entry...

I had finally found a way of populating fields in my new form with info taken from the first.

Now...probably getting to involved in the look and feel of my project here but what I'm trying to acheive is hopefully simple?

The On_Click of cmdADD_PC closed the current form (frmAdmin) and opened frmADD_PC...

The DID# field of ADD_PC was autofilled from frmAdmin:

=[Forms]![frmAdminDetails]![DID#]

this was working fine, in addition a 2nd field (Client) was populated with the following:

SELECT Dealers.Client FROM Dealers WHERE (((Dealers.dealerID) Like Forms!frmAdminDetails![DID#] & "*"));

this ref. the DID# and filled the Client field with the correct Dealer Name, so far so good I thought...

However when I introduced the following code to my cmdADD_PC control on frmAdmin the fields in frmADD_PC no longer auto-fill :confused:

On Error GoTo Err_ADD_PC_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmCompSpecs"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, "frmAdminDetails"
Exit_ADD_PC_Click:
Exit Sub

Err_ADD_PC_Click:
MsgBox Err.Description
Resume Exit_ADD_PC_Click

End Sub

this is successful in closing the current form and opening ADD_PC which gives the effect I want however as the frmAdmin is closed I take it that the field info lookup code on ADD_PC has no data to retrieve from frmAdmin (at least I hope this is the case)

So I wandered if there was a simple way to instead of close the frmAdmin, set it's visibility to No on the Load event of frmADD_PC as I take it this might prevent this problem with the field lookup I have set...?

I'm a complete and utter virgin in regards of VB and I'm trying to work things through slowly here, so any pointers in the right direction would be great folks :)

Many thanks for any interest and suggestions :)

zym
 
zym,

You could consider leaving your admin form open, since they
will probably go back to it.

Open the new form and have it be a "modal" form. That way
the user is trapped in the new (short term) form, your
references to the admin form are valid, and when they complete
their task they will be returned to the admin form.

btw,

stLinkCriteria is not defined in when you do your .OpenForm.

Wayne
 
thx for gettin back Wayne

Thanks for the info Wayne...

At first this is the way I had it set (Admin form remains open) then as I say for appearance I had the Admin form close when the ADD_PC loaded...

Its more of a personal option having the visible props of frmAdmin set to "NO" if possible :)

As an aside alomost...once the control cmdADD_PC has been clicked on and opened it's disabled from being re-used, and displays a new caption "PC Added"...

Would there be a way of adding a 3rd control to my form to start afresh...eg Create a new Admin entry and have the ADD_PC cmd button re-enabled ?

At present the only way I can do this is to close the frmAdmin and re-open it ? :(

zym
 
zym,

You can use:

Forms![frmAdmin].Visible = False

in the OnOpen event of your Client form. You can reverse it
when you exit the form.

I'm not understanding your last question. You can create a
new command button. In its OnClick event you can:

Me.ADD_PC.Enabled = True
Me.ADD_PC.Caption = "Whatever"
DoCmd.GoTo acNewRecord

I'm going to have to research the last one because I don't
have Access with me and I don't know the syntax since I
don't use that often.

Wayne
 
You are a Star

Wayne

Thanks for the help here mate, very very much appreciated :)

Bit over tired now, and VB hard enough for me at the best of times :)

Will try your suggestions out first thing and get back and let you know how it goes...

Once again thanks for the help and hints and for taken the time to look into it for me...

zym
 
Temptation got better of me...

Wayne

Could not fae sleep without trying your solution out first :)

What can I say buddy you were spot on, many thanks maybe sleep will once more be enjoyed in this house (until next problem rears it's head).

Thanks for the assisstance and pointers...

Zym
 

Users who are viewing this thread

Back
Top Bottom