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

Popup modal form

P: n/a
Hi!
I have problems to set focus to a popup form, if it is not modal. If I set
modal to true then that problem is solved, but then the main form closes
together with the subform, wich in not acceptable. Is there a solution to
this problem??

Sigurd

--
____________________________________________
KILLSPAM R e m o v e trippleX to reply
to email adress.
Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Try posting your code as your description does not match how Access normally
works.

Terry

"Sigurd Bruteig" <s-********@online.no> wrote in message
news:5j********************@news2.e.nsc.no...
Hi!
I have problems to set focus to a popup form, if it is not modal. If I set
modal to true then that problem is solved, but then the main form closes
together with the subform, wich in not acceptable. Is there a solution to
this problem??

Sigurd

--
____________________________________________
KILLSPAM R e m o v e trippleX to reply
to email adress.

Nov 12 '05 #2

P: n/a

"Terry Kreft" <te*********@mps.co.uk> skrev i melding
news:bl**********@newsreaderm1.core.theplanet.net. ..
Try posting your code as your description does not match how Access normally works.


Thank you! I could try the code on another computer. Or maybee instead of
close the popup set its visible property to false? Then I suppose it is
closed together with the parent form.

Code below.

Sigurd

'* This code opens the popup form from Parent

Dim stDocName As String
stDocName = "frmFakturanrInput"
Dim strNoData As String
Dim rstCount As Recordset

Set rstCount = Me.RecordsetClone
If rstCount.RecordCount = 0 Then

DoCmd.OpenForm stDocName ', , , , , "OpenArgsCurrently not in use"

End If
Set rstCount = Nothing

'***THIS is code on a popupform button, that is doing the work on the popup,
comments not transelated from norwegian

Private Sub cmdNyttNr_Click()
Dim lngStartnummer
Dim lngX As Long

On Error GoTo HandleErr

'Finner høyeste timelistenr, det kan ikke registreres nytt timelistenr
'som er lavere en høyeste registrerte
lngX = Nz(DMax("[Fakturano]", "tblFaktura"))
Dim intResult As Integer
If IsNull([txtNyttFakturanr]) Then

MsgBox " Du må skrive inn et tall", vbInformation, "Skriv inn et tall"
Me.txtNyttFakturanr.SetFocus

ElseIf [txtNyttFakturanr] <= lngX Then
MsgBox "Du kan ikke gi fakturaen et nummer" & vbCrLf & "som er lavere en
det høyeste registrerte nummer" _
& vbCrLf & "eller et tall som er mindre en 1", vbInformation, "Nummeret
eksisterer"
Me.txtNyttFakturanr = ""
Me.txtNyttFakturanr.SetFocus
Exit Sub
Else
intResult = MsgBox("Du har valgt startnummer " & [txtNyttFakturanr] & _
" er dette riktig? ", vbInformation + vbYesNoCancel + _
vbDefaultButton1 + vbApplicationModal, "Angi startnummer")
End If
If intResult = vbYes Then
lngStartnummer = Me.txtNyttFakturanr
[Forms]![frmFaktura]!txtFakturano = lngStartnummer
If IsNull(txtNyttFakturanr) Then

Me.txtNyttFakturanr.SetFocus
Exit Sub
End If

'Forms!frmTimelistenrInput.Visible = False
DoCmd.Close acForm, "frmFakturanrInput"
MsgBox "Du kan nå starte med å skrive faktura!", _
vbOKOnly, "Skriv faktura!"
ElseIf intResult = vbNo Then
Me.txtNyttFakturanr.SetFocus
Me.txtNyttFakturanr = ""

ElseIf intResult = vbCancel Then
DoCmd.Close
DoCmd.Close acForm, "frmFaktura", acSaveNo

End If


ExitHere:
Exit Sub

' Error handling block added by VBA Code Commenter and Error Handler Add-In.
DO NOT EDIT this block of code.
' Automatic error handler last updated at 26. mars 2003 09:37:29
HandleErr:
Select Case Err.Number
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical,
"Form_frmFakturanrInput.cmdNyttNr_Click"
End Select
Resume ExitHere
' End Error handling block.
End Sub

Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.